/* Full chat module ported from docs/hcs-hanh-chinh-so/css/app.css (.chat-app … mobile) */
/* Includes .msg / .chat-compose / .chat-send — previously missing from pages.css */

.chat-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.page-chat.chat-app {
  height: 100%;
}

.page-chat {
  flex: 1;
  min-height: 0;
  padding: 12px 16px 16px;
  background: var(--color-background, #F3F7F8);
}

.page-chat button:not(.btn):not(.chat-send) {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.chat-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.chat-shell.is-info-open {
  grid-template-columns: 280px minmax(0, 1fr) 420px;
}

.chat-list,
.chat-thread,
.chat-info {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.chat-info-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 16px 18px 10px;
}

.chat-info-head .chat-info-kicker {
  flex: 1;
  min-width: 0;
}

.chat-info-kicker {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-800);
}

.chat-info-head h2 {
  margin: 2px 0 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-800);
}

.chat-info-body {
  flex: 1;
  overflow: auto;
  padding: 8px 20px 24px;
}

.chat-info-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0 20px;
}

.chat-avatar.lg {
  width: 104px;
  height: 104px;
  min-width: 104px;
  font-size: 32px;
}

.chat-avatar.lg .chat-dot {
  width: 12px;
  height: 12px;
  left: auto;
  right: 4px;
  bottom: 6px;
}

.chat-info-profile p {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-muted);
}

.chat-name-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-800);
  text-align: center;
}

.chat-name-btn:hover {
  background: var(--color-gray-50);
}

.chat-name-btn svg {
  width: 16px;
  height: 16px;
  color: var(--color-muted);
  flex-shrink: 0;
}

.chat-name-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-name-btn:hover svg {
  color: var(--color-primary);
}

.chat-name-btn[hidden],
.chat-rename-input[hidden] {
  display: none !important;
}

.chat-rename-input {
  width: 100%;
  max-width: 280px;
  text-align: center;
  font-weight: var(--font-weight-semibold);
}

.chat-info-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 22px;
}

.chat-info-actions .btn {
  justify-content: center;
}

.chat-info-section {
  margin-bottom: 20px;
}

.chat-info-section h3 {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-gray-500);
}

.chat-member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-member {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.chat-member-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.chat-member .doc-action {
  margin-left: auto;
  flex-shrink: 0;
}

.chat-member-meta strong {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-800);
}

.chat-member-meta span {
  font-size: 12px;
  color: var(--color-muted);
}

.chat-info-section .chat-media-btn + .chat-media-btn {
  margin-top: 8px;
}

.chat-media-btn.is-active {
  background: var(--color-primary-soft);
}

.chat-media-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--color-gray-100);
  margin-bottom: 12px;
}

.chat-media-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 40px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.chat-media-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.chat-media-tab:hover {
  color: var(--color-primary);
}

.chat-media-tab.is-active,
.chat-media-tab.is-active:active,
.chat-media-tab:active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: transparent;
}

.chat-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.chat-media-grid[hidden] {
  display: none;
}

.chat-media-grid .chat-media-empty {
  grid-column: 1 / -1;
}

.chat-thumb {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  aspect-ratio: 1;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--color-gray-100);
  min-height: 0;
}

.chat-thumb:hover {
  box-shadow: var(--shadow-sm);
}

.chat-thumb-img {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.9);
}

.chat-thumb-img svg {
  width: 28px;
  height: 28px;
}

.chat-thumb-img.is-teal { background: linear-gradient(145deg, var(--color-teal-300), var(--color-teal-700)); }
.chat-thumb-img.is-blue { background: linear-gradient(145deg, #93C5FD, #2563EB); }
.chat-thumb-img.is-sand { background: linear-gradient(145deg, #F6E7B8, #D97706); }
.chat-thumb-img.is-mint { background: linear-gradient(145deg, #BBF7D0, #16A34A); }

.chat-thumb-file {
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 8px 8px;
  border: 1px solid var(--color-border);
  background: var(--color-white);
}

.chat-thumb-ext {
  display: grid;
  place-items: center;
  width: 42px;
  height: 48px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.04em;
  color: var(--color-white);
  background: var(--color-primary);
}

.chat-thumb-ext.is-pdf { background: #DC2626; }
.chat-thumb-ext.is-doc { background: #2563EB; }
.chat-thumb-ext.is-xls { background: #16A34A; }
.chat-thumb-ext.is-txt { background: var(--color-gray-500); }

.chat-thumb-name {
  display: block;
  width: 100%;
  font-size: 11px;
  color: var(--color-gray-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.chat-thumb-wrap {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
}

.chat-thumb-wrap .chat-thumb {
  width: 100%;
  height: 100%;
}

.chat-thumb-dl {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.chat-thumb-wrap:hover .chat-thumb-dl,
.chat-thumb-wrap:focus-within .chat-thumb-dl,
.chat-thumb-dl:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.chat-thumb-dl:hover,
.chat-thumb-dl:focus-visible {
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
}

.chat-thumb-dl svg,
.chat-file-dl svg {
  display: block;
  width: 12px;
  height: 12px;
}

.chat-file-dl {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--color-muted);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.chat-thumb-file:hover .chat-file-dl,
.chat-thumb-file:focus-visible .chat-file-dl {
  opacity: 1;
}

@media (hover: none) {
  .chat-thumb-dl,
  .chat-file-dl {
    opacity: 1;
    pointer-events: auto;
  }
}

.chat-media-empty {
  margin: 0;
  padding: 16px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--color-muted);
  background: var(--color-gray-50);
  border-radius: 10px;
}

.chat-more .icon-btn.is-active,
.chat-info-head .icon-btn.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.chat-list-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 8px;
}

.chat-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  background: var(--color-gray-100);
  border-radius: var(--radius-full);
  color: var(--color-muted);
}

.chat-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  height: 40px;
  color: var(--color-foreground);
}

.chat-search input:focus {
  outline: none;
}

.chat-search-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.chat-list-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 4px 12px 0;
  border-bottom: 1px solid var(--color-gray-100);
}

.chat-list-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  padding: 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  box-shadow: none;
  margin-bottom: -1px;
}

.chat-list-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.chat-list-tab.is-active,
.chat-list-tab.is-active:active,
.chat-list-tab:active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: transparent;
}

.chat-list-body {
  flex: 1;
  overflow: auto;
  padding: 8px 0;
}

.chat-contacts {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.chat-contact-search {
  flex: none;
  margin: 8px 14px 4px;
}

.chat-contact-search input {
  width: 100%;
}

.chat-contact-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 4px 0;
}

.chat-contact {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 8px 16px;
  cursor: pointer;
}

.chat-contact:hover {
  background: var(--color-gray-50);
}

.chat-contact input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.chat-contact-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

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

.chat-contact-meta strong {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-foreground);
}

.chat-contact-meta span {
  font-size: var(--font-size-xs);
  color: var(--color-muted);
}

.chat-contact-foot {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 16px;
}

.chat-group-name {
  height: 40px;
  border: 0;
  background: var(--color-gray-100);
  border-radius: 10px;
}

.chat-contact-foot .btn {
  width: 100%;
  min-height: 40px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  min-height: 64px;
  padding: 10px 16px;
  background: transparent;
  border: 0;
  border-radius: 0;
  border-left: 3px solid transparent;
  box-shadow: none;
}

.chat-item:hover {
  background: var(--color-gray-50);
}

.chat-item.is-active {
  background: #E7F7F4;
  border-left-color: var(--color-primary);
}

.chat-item.is-pinned:not(.is-active) {
  background: #F7FBFB;
}

.chat-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--radius-full);
  background: #D8F4F0;
  color: var(--color-primary);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: var(--font-weight-bold);
}

.chat-avatar.is-group {
  background: #DCEBFE;
  color: #2563EB;
}

.chat-avatar.sm {
  width: 28px;
  height: 28px;
  min-width: 28px;
  font-size: 10px;
}

.chat-dot {
  position: absolute;
  left: 1px;
  bottom: 1px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: #22C55E;
  box-shadow: 0 0 0 2px var(--color-white);
}

.chat-dot.is-offline {
  background: var(--color-gray-400, #94A3B8);
}

.chat-presence-line {
  display: block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.chat-presence-line.is-online {
  color: #16A34A;
}

.chat-presence-line.is-offline {
  color: #94A3B8;
}

.chat-incoming-banner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: calc(100% - 24px);
  margin: 8px 12px 0;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: #E7F6F3;
  color: #0E7A70;
  text-align: left;
  cursor: pointer;
}

.chat-incoming-banner strong {
  font-size: 12px;
}

.chat-incoming-banner span {
  font-size: 13px;
  font-weight: 600;
  color: #134E4A;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.chat-item-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-item-top time {
  color: var(--color-muted);
  font-size: 12px;
  flex-shrink: 0;
}

.chat-item-preview {
  color: var(--color-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-thread-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-gray-100);
  flex-shrink: 0;
}

.chat-thread-meta {
  flex: 1;
  min-width: 0;
}

.chat-thread-meta h1 {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-800);
}

.chat-thread-meta p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-gray-400);
  flex-shrink: 0;
}

.chat-more {
  position: relative;
}

.chat-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 8px;
  z-index: var(--z-dropdown);
}

.chat-more-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: var(--font-size-sm);
  color: var(--color-gray-700);
}

.chat-more-menu button:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary-active);
}

.chat-msgs {
  flex: 1;
  overflow: auto;
  padding: 20px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.chat-item-end {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-pin-mark {
  width: 10px;
  height: 10px;
  background: currentColor;
  color: var(--color-primary);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 3H8l1 7a4 4 0 1 0 6 0L16 3zm-4 14v5'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 3H8l1 7a4 4 0 1 0 6 0L16 3zm-4 14v5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.chat-item.is-pinned .chat-pin-mark,
.chat-item.is-pinned .chat-pin-mark[hidden] {
  display: inline-block;
}

.chat-pin-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-gray-100);
  background: #F0FDFA;
  color: var(--color-primary-active);
  flex-shrink: 0;
}

.chat-pin-bar[hidden] {
  display: none;
}

.chat-pin-bar-body {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}

.chat-pin-bar-body strong {
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
}

.chat-pin-bar-body span {
  font-size: 12px;
  color: var(--color-gray-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: min(78%, 520px);
}

.msg.is-out {
  margin-left: auto;
  justify-content: flex-end;
}

.msg-stack {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.msg-bubble {
  position: relative;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: var(--font-size-sm);
  line-height: 1.45;
  word-break: break-word;
}

.msg.is-in .msg-bubble {
  background: #F6E7B8;
  color: var(--color-gray-800);
  border-bottom-left-radius: 4px;
}

.msg.is-out .msg-bubble {
  background: var(--color-primary);
  color: var(--color-white);
  border-bottom-right-radius: 4px;
}

.msg-name {
  display: block;
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  color: var(--color-gray-600);
  margin-bottom: 2px;
}

.msg-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
  color: var(--color-gray-500);
  opacity: 0;
  flex-shrink: 0;
}

.msg:hover .msg-more,
.msg:focus-within .msg-more,
.msg.is-menu-open .msg-more,
.msg-more-wrap.is-open .msg-more,
.msg-more[aria-expanded="true"] {
  opacity: 1;
}

.msg-more:hover,
.msg-more[aria-expanded="true"] {
  background: var(--color-gray-100);
  color: var(--color-gray-700);
}

.msg.is-pinned .msg-bubble {
  box-shadow: inset 0 0 0 1px rgba(15, 122, 112, 0.28);
}

.msg.is-recalled .msg-bubble {
  background: transparent;
  border: 1px dashed var(--color-gray-300);
  color: var(--color-muted);
  font-style: italic;
}

.msg.is-out.is-recalled .msg-bubble {
  color: var(--color-muted);
}

.msg-media {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 148px;
}

.msg-media-card {
  display: grid;
  place-items: center;
  height: 96px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.92);
}

.msg-media-card svg {
  width: 28px;
  height: 28px;
}

.msg-media-caption,
.msg-file-name {
  font-size: 12px;
}

.msg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 8px 10px 8px 8px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: background-color var(--duration, 150ms) var(--ease, ease), box-shadow var(--duration, 150ms) var(--ease, ease);
}

button.msg-file {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.msg.is-in .msg-file {
  background: #fff;
  border: 1px solid var(--color-border, #E2E8F0);
  color: var(--color-gray-800, #1E293B);
}

.msg.is-out .msg-file {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.msg-file:hover,
.msg-file:focus-visible {
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(15, 23, 42, 0.08));
}

.msg.is-in .msg-file:hover,
.msg.is-in .msg-file:focus-visible {
  background: var(--color-gray-50, #F8FAFC);
}

.msg.is-out .msg-file:hover,
.msg.is-out .msg-file:focus-visible {
  background: rgba(255, 255, 255, 0.28);
}

.msg.is-out .msg-file .chat-thumb-ext {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.msg-quote {
  display: block;
  margin: 0 0 6px;
  padding: 6px 8px;
  border-left: 2px solid currentColor;
  opacity: 0.88;
  font-size: 12px;
  border-radius: 0 6px 6px 0;
}

.msg.is-in .msg-quote {
  background: rgba(15, 23, 42, 0.06);
}

.msg.is-out .msg-quote {
  background: rgba(255, 255, 255, 0.16);
}

.msg.is-flash .msg-bubble {
  animation: msg-flash 1.1s ease;
}

@keyframes msg-flash {
  0%, 100% { box-shadow: inset 0 0 0 0 transparent; }
  35% { box-shadow: inset 0 0 0 2px rgba(15, 122, 112, 0.45); }
}

.chat-pin-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #F0FDFA;
  text-align: left;
}

.chat-pin-info:hover {
  background: #DDF7F3;
}

.chat-pin-info strong {
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary-active);
}

.chat-pin-info span {
  font-size: 12px;
  color: var(--color-gray-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.msg-fwd-label,
.msg-task-label {
  display: block;
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
  opacity: 0.8;
}

.msg-task-card {
  min-width: 200px;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  color: var(--color-gray-800, #1E293B);
}

.msg-task-card strong {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--color-gray-900, #0F172A);
}

.msg-task-card p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--color-gray-600, #475569);
  opacity: 1;
}

.msg-task-card a,
.msg-task-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  background: none;
  border: 0;
  color: var(--color-primary, #007f7c);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.msg-task-open:hover,
.msg-task-open:focus-visible,
.msg-task-card a:hover,
.msg-task-card a:focus-visible {
  color: var(--color-primary-hover, #006866);
}

.msg-task-open svg {
  flex-shrink: 0;
}

.msg-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--hcs-z-popover, 350) + 15);
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(15, 23, 42, 0.28);
  cursor: default;
}

.msg-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: calc(var(--hcs-z-popover, 350) + 20);
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(300px, calc(100vw - 24px));
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.msg-menu[hidden] {
  display: none;
}

.msg-react-sheet,
.msg-action-sheet {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
}

.msg-react-sheet {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
}

.msg-action-sheet {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 4px 2px 2px;
}

.msg-menu button.msg-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 6px 2px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #1c2b33;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}

.msg-menu button.msg-action span {
  display: block;
  max-width: 100%;
}

.msg-menu button.msg-action:hover,
.msg-menu button.msg-action:focus-visible {
  background: #f4f7f8;
  color: #1c2b33;
}

.msg-menu button.msg-action svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.msg-menu button.msg-action--reply svg { color: #7c4dff; }
.msg-menu button.msg-action--forward svg { color: #1e88e5; }
.msg-menu button.msg-action--save svg { color: #29b6f6; }
.msg-menu button.msg-action--copy svg { color: #5c6bc0; }
.msg-menu button.msg-action--pin svg { color: #fb8c00; }
.msg-menu button.msg-action--task svg { color: #14998c; }
.msg-menu button.msg-action--delete,
.msg-menu button.msg-action--delete svg { color: #e05252; }

.msg-menu button.msg-action--delete:hover,
.msg-menu button.msg-action--delete:focus-visible {
  background: #fef2f2;
  color: #e05252;
}

.msg-menu button.msg-action:disabled {
  opacity: 0.45;
}

.chat-dialog {
  width: min(440px, calc(100vw - 32px));
  max-width: 440px;
  height: auto;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: min(86vh, 640px);
  overflow: hidden;
  align-self: center;
  justify-self: center;
}

.chat-dialog-head,
.chat-dialog-foot {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
}

.chat-dialog-head {
  justify-content: space-between;
  padding: 16px 18px 8px;
}

.chat-dialog-head h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: var(--font-size-lg);
  color: var(--color-primary);
}

.chat-dialog-foot {
  justify-content: flex-end;
  padding: 8px 18px 16px;
}

.chat-dialog-view {
  padding: 8px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.chat-dialog-view[hidden] {
  display: none;
}

.chat-dialog-copy {
  margin: 0;
  color: var(--color-gray-700);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.chat-dialog-preview {
  padding: 10px 12px;
  background: var(--color-gray-50);
  border-radius: 10px;
  font-size: var(--font-size-sm);
  color: var(--color-gray-700);
}

.forward-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
}

.forward-list--people {
  max-height: 320px;
}

.forward-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 10px;
  text-align: left;
  width: 100%;
}

.forward-option:hover,
.forward-option.is-selected {
  background: var(--color-primary-soft);
}

.forward-option .chat-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  font-size: 11px;
}

.forward-option-meta {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.forward-option-meta strong,
.forward-option-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forward-option-meta strong {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-foreground);
}

.forward-option-meta span {
  font-size: var(--font-size-xs);
  color: var(--color-muted);
}

.forward-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(52vh, 440px);
  overflow: auto;
}

.forward-picker .forward-list {
  max-height: none;
  overflow: visible;
}

.forward-section {
  margin: 8px 2px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-muted, #64748b);
}

.forward-empty {
  margin: 0;
  padding: 4px 8px 8px;
  font-size: 13px;
  color: var(--color-muted, #64748b);
}

.forward-already {
  color: var(--color-primary, #14998c) !important;
  font-size: 12px;
}

.forward-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: auto;
  border: 2px solid #b7c3ce;
  border-radius: 999px;
  flex: 0 0 20px;
  color: #fff;
}

.forward-check.is-on {
  background: var(--color-primary, #14998c);
  border-color: var(--color-primary, #14998c);
}

.forward-check svg {
  width: 12px;
  height: 12px;
}

.forward-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 8px;
  background: var(--color-gray-50, #f8fafc);
}

.forward-preview p {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.forward-preview span {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--color-primary, #14998c) 12%, #fff);
  color: var(--color-primary, #14998c);
  font-size: 12px;
}

.forward-foot {
  gap: 12px;
}

.forward-foot p {
  flex: 1;
  margin: 0;
  font-size: 13px;
  color: var(--color-muted, #64748b);
}

.chat-pick-list {
  gap: 8px;
  max-height: 280px;
}

.page-chat button.chat-pick-option:not(.btn) {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 12px;
  border: 1px solid var(--color-gray-200, #E2E8F0);
  border-radius: 12px;
  background: var(--color-white, #fff);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.page-chat button.chat-pick-option:not(.btn):hover {
  border-color: var(--color-primary, #0D9488);
  background: var(--color-primary-soft, #E6F3F2);
}

.page-chat button.chat-pick-option:not(.btn).is-selected {
  border-color: var(--color-primary, #0D9488);
  background: var(--color-primary-soft, #E6F3F2);
  box-shadow: inset 0 0 0 1px var(--color-primary, #0D9488);
}

.page-chat button.chat-pick-option:not(.btn) .chat-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  font-size: 12px;
}

.page-chat button.chat-pick-option:not(.btn) .chat-pick-mark {
  width: 20px;
  height: 20px;
  margin-left: auto;
  flex-shrink: 0;
  border: 2px solid #CBD5E1;
  border-radius: 50%;
  background: #fff;
}

.page-chat button.chat-pick-option:not(.btn).is-selected .chat-pick-mark {
  border-color: var(--color-primary, #0D9488);
  background:
    radial-gradient(circle at center, #fff 0 3px, transparent 3.5px),
    var(--color-primary, #0D9488);
}

#chat-pin-conv.is-active,
#chat-assign-open.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.chat-empty {
  margin: auto;
  color: var(--color-muted);
  font-size: var(--font-size-sm);
}

.chat-compose {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 6;
  overflow: visible;
  background: var(--color-white);
  border-top: 1px solid var(--color-gray-100, #F1F5F9);
}

.chat-attach,
.chat-assign {
  background: var(--color-gray-50);
  color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.chat-attach-input {
  clip: auto !important;
  cursor: pointer;
  font-size: 0;
  height: 100%;
  inset: 0;
  margin: 0;
  opacity: 0;
  padding: 0;
  position: absolute;
  width: 100%;
}

.chat-attach svg,
.chat-assign svg {
  pointer-events: none;
}

.chat-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-muted);
}

.chat-mention {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-full);
  background: var(--color-gray-50);
  color: var(--color-primary);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.chat-input-wrap.is-mentioning textarea {
  field-sizing: content;
  flex: 0 1 auto;
  min-width: 6ch;
  max-width: 46%;
  width: auto;
}

.chat-mention-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.chat-mention-inline::-webkit-scrollbar {
  display: none;
}

.chat-mention-chip {
  flex: 0 0 auto;
  height: 28px;
  max-width: 180px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: var(--color-gray-100, #F1F5F9);
  color: var(--color-foreground);
  font-size: var(--font-size-sm, 13px);
  font-weight: 600;
  line-height: 28px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-mention-chip.is-active,
.chat-mention-chip:hover {
  background: var(--color-primary, #007f7c);
  color: #fff;
}

.msg-mention {
  border-radius: 999px;
  font-weight: 700;
  padding: 0 4px;
}

.msg.is-in .msg-mention {
  background: color-mix(in srgb, var(--color-primary) 14%, transparent);
  color: var(--color-primary-active, var(--color-primary));
}

.msg.is-out .msg-mention {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.chat-input-wrap input {
  flex: 1;
  min-width: 0;
  border: 0;
  height: 44px;
  background: transparent;
  color: var(--color-foreground);
}

.chat-input-wrap input:focus {
  outline: none;
}

.chat-input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}

.chat-send {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-white);
}

.chat-send:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 1200px) and (min-width: 901px) {
  .chat-shell.is-info-open {
    grid-template-columns: minmax(0, 1fr) minmax(0, 390px);
  }

  .chat-shell.is-info-open.chat-shell--compact-info {
    grid-template-columns: minmax(0, 1fr) minmax(0, 280px);
  }

  .chat-shell.is-info-open .chat-list {
    display: none;
  }
}

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .page-home .ws-span-3 { grid-column: span 6; }
  .page-home .ws-span-8,
  .page-home .ws-span-4 { grid-column: span 12; }
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .week > :nth-child(n+8) { display: none; }
  .process-split { grid-template-columns: 1fr; }
  .vb-shell { grid-template-columns: 1fr; }
  .vb-aside {
    order: -1;
    border-left: 0;
    border-bottom: 1px solid var(--color-gray-100);
  }
  .vb-chrome {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }
  .vb-chrome .vb-flow {
    border-right: 0;
    padding-right: 0;
  }
  .vb-preview-frame {
    min-height: 360px;
    height: 50vh;
  }
}

@media (max-width: 1024px) {
  .brand-text {
    display: none;
  }

  .icon-btn.menu-toggle {
    display: inline-flex;
    color: var(--color-gray-800);
  }

  .nav-overlay {
    display: block;
    position: fixed;
    inset: var(--header-height) 0 0 0;
    z-index: 35;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration) var(--ease);
  }

  .nav-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 33.333vw;
    min-width: 260px;
    max-width: 86vw;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 8px 20px;
    overflow-x: hidden;
    overflow-y: auto;
    transform: translateX(-110%);
    transition: transform var(--duration) var(--ease);
    box-shadow: var(--shadow-lg);
  }

  .nav.is-open {
    transform: translateX(0);
  }

  .nav-item {
    width: 100%;
    justify-content: flex-start;
    border-radius: 10px;
    min-height: 44px;
    white-space: nowrap;
    line-height: 1.25;
    padding: 8px 12px;
    font-size: 14px;
  }

  .nav-item .chevron {
    margin-left: auto;
  }

  .menu-wrap {
    width: 100%;
  }

  .menu-mega {
    min-width: 0;
    right: auto;
    left: 0;
    padding: 6px 4px 8px;
  }

  .mega-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .menu {
    position: static;
    min-width: 0;
    margin: 4px 0 8px;
    background: rgba(255, 255, 255, 0.12);
    border: 0;
    box-shadow: none;
    border-radius: 10px;
  }

  .menu::before {
    display: none;
  }

  .menu a,
  .menu button {
    color: var(--color-white);
    min-height: 40px;
  }

  .menu a svg,
  .menu button svg {
    color: var(--color-white);
  }

  .menu a:hover,
  .menu button:hover,
  .menu a.is-current {
    background: rgba(255, 255, 255, 0.16);
    color: var(--color-white);
  }

  .menu-label {
    color: rgba(255, 255, 255, 0.7);
  }

  .menu-sep {
    background: rgba(255, 255, 255, 0.16);
  }

  .menu a.is-danger {
    color: #FECACA;
  }
}

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

  .queue-side-label {
    padding-bottom: 0;
  }

  .queue-keyword,
  .queue-search-btn {
    grid-column: 1;
  }
}

@media (max-width: 900px) {
  .kb-board {
    grid-template-columns: minmax(240px, 1fr);
  }

  .wf-split,
  .wf-form-grid,
  .wf-step-form,
  .wf-paper-head {
    grid-template-columns: 1fr;
  }

  .wf-paper-head p:last-child {
    text-align: left;
  }

  .wf-stepper li {
    flex: 1 1 0;
  }
}

@media (max-width: 768px) {
  .login-card { padding: 24px 20px; }
  .topbar { padding: 0 12px; }
  .user-meta { display: none; }
  .page { padding: 16px 12px 32px; }
  .chat-app .page-chat { padding: 8px; }
  .grid-4 { grid-template-columns: 1fr; }
  .page-home .ws-span-3 { grid-column: span 12; }
  .page-home .filter-bar { flex-wrap: wrap; }
  .page-home .filter-dates { flex-basis: 100%; }
  .lang-chip [data-lang-code] { display: none; }
  .docs-layout { grid-template-columns: 1fr; }
  .vb-file-grid,
  .vb-assign-row { grid-template-columns: 1fr; }
  .vb-field-row { grid-template-columns: 1fr; }
  .vb-preview { position: static; min-height: 240px; }
  .vb-card { padding: 0; }
  .vb-pane { padding: 16px 16px 8px; min-height: 0; }
  .vb-bar { padding: 12px 16px 16px; }
  .docs-toolbar { flex-wrap: wrap; }
  .docs-table-wrap { overflow: hidden; }
  .page-actions { flex-wrap: wrap; }
  .queue-filter { padding: 16px; }
  .chat-shell {
    grid-template-columns: 1fr;
  }
  .chat-thread {
    display: none;
  }
  .chat-shell.is-thread-open .chat-list {
    display: none;
  }
  .chat-shell.is-thread-open .chat-thread {
    display: flex;
  }
  .chat-shell.is-info-open,
  .chat-shell.is-thread-open {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    width: 100%;
  }
  .chat-shell.is-info-open .chat-list,
  .chat-shell.is-info-open .chat-thread {
    display: none;
  }
  .chat-shell.is-info-open .chat-info {
    display: flex;
    max-width: none;
    min-width: 0;
    width: 100%;
  }
  .msg-more { opacity: 1; }
  .page-chat button.msg-like {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ——— Blazor extras (keep chat.html look for product-only chrome) ——— */
.chat-status-dot.is-online {
  background: #22C55E;
}

.msg-more-wrap {
  position: relative;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}

.msg-bubble p {
  margin: 0;
}

.msg-bubble .msg-name + p {
  margin-top: 2px;
}

.msg-foot {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 4px;
}

.msg.is-out .msg-foot {
  justify-content: flex-end;
}

.msg.has-react {
  margin-bottom: 10px;
}

.msg.has-react.is-in .msg-foot {
  padding-right: 52px;
}

.msg.has-react.is-out .msg-foot {
  padding-left: 52px;
}

.msg-reacts {
  position: absolute;
  z-index: 2;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: translateY(42%);
}

.msg.is-in .msg-reacts.has-count {
  right: 0;
  transform: translate(10px, 50%);
}

.msg.is-out .msg-reacts.has-count {
  left: 0;
  transform: translate(-10px, 50%);
}

.msg.is-in .msg-reacts:not(.has-count) {
  right: 0;
  transform: translate(8px, 8px);
}

.msg.is-out .msg-reacts:not(.has-count) {
  left: 0;
  transform: translate(-8px, 8px);
}

.page-chat button.msg-react:not(.btn) {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px 0 6px;
  border: 1px solid #e7edf4;
  border-radius: 999px;
  background: #fff;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.page-chat button.msg-react svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #e11d48;
}

.page-chat button.msg-react.is-on:not(.btn) {
  border-color: #bfdbfe;
  background: #f8fbff;
}

.msg-react-glyphs {
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.msg-react-pop {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  z-index: 6;
  flex-direction: column;
  gap: 2px;
  width: max-content;
  padding: 4px;
  background: #fff;
  border: 1px solid #e7edf4;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.msg-react-pop::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 12px;
  bottom: -12px;
}

.msg.is-in .msg-react-pop {
  left: 0;
}

.msg.is-out .msg-react-pop {
  right: 0;
}

.msg:hover,
.msg:focus-within,
.msg-reacts.is-open {
  z-index: 5;
}

.msg-reacts:hover .msg-react-pop,
.msg-reacts:focus-within .msg-react-pop,
.msg-reacts.is-open .msg-react-pop,
.msg-react-bar .msg-react-pop {
  display: flex;
  position: static;
}

.msg-reacts:hover .msg-react-pop,
.msg-reacts:focus-within .msg-react-pop,
.msg-reacts.is-open .msg-react-pop {
  position: absolute;
}

.msg-reacts.is-latched .msg-react-pop,
.msg-reacts.is-latched:hover .msg-react-pop,
.msg-reacts.is-latched:focus-within .msg-react-pop,
.msg-reacts.is-latched.is-open .msg-react-pop {
  display: none;
}

.msg-react-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.page-chat button.msg-emoji,
.page-chat button.msg-emoji-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.page-chat button.msg-emoji.is-on {
  background: #e8f4fd;
}

.page-chat button.msg-emoji-more {
  flex-basis: 28px;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  border-radius: 999px;
  background: #f0f2f5;
  color: #5e7572;
  font-size: 18px;
  font-weight: 600;
}

.msg-react-bar {
  padding: 2px 2px 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
}

.msg-react-bar .msg-react-pop {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  position: static;
  width: 100%;
}

.msg-react-bar .msg-react-pop::before {
  content: none;
}

.msg-emoji-spacer {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
}

.msg-menu button.msg-emoji,
.msg-menu button.msg-emoji-more {
  width: auto;
  min-height: 32px;
  padding: 0;
  gap: 0;
}

.msg-menu .msg-react-row {
  width: 100%;
}

.msg-menu button.msg-emoji {
  flex: 1 1 0;
}

.page-chat button.msg-react:disabled,
.page-chat button.msg-like:disabled {
  cursor: default;
  opacity: 0.6;
}

.hcs-app-shell .page-chat button.msg-like:not(.btn),
.page-chat button.msg-like:not(.btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  min-height: 26px !important;
  max-width: 26px !important;
  max-height: 26px !important;
  margin: 0;
  padding: 0 !important;
  border: 1px solid #fff !important;
  border-radius: 999px;
  background: #fff !important;
  color: #8b95a1 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16);
  opacity: 0;
  pointer-events: none;
  flex: 0 0 26px;
  cursor: pointer;
}

.hcs-app-shell .page-chat button.msg-like svg,
.page-chat button.msg-like svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
}

.msg-reacts.has-count .msg-like {
  display: none;
}

.msg:hover .msg-reacts:not(.has-count) .msg-like,
.msg:focus-within .msg-reacts:not(.has-count) .msg-like,
.msg.is-menu-open .msg-reacts:not(.has-count) .msg-like {
  opacity: 1;
  pointer-events: auto;
}

.msg-time {
  display: block;
  margin-top: 0;
  font-size: 11px;
  opacity: 0.72;
}

.msg.is-out .msg-time {
  text-align: right;
}

.msg-quote {
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.msg-quote strong,
.msg-quote span {
  display: block;
}

.msg-media-card {
  overflow: hidden;
  height: auto;
  min-height: 96px;
  padding: 0;
  cursor: pointer;
}

.msg-media-card img {
  display: block;
  width: 220px;
  max-width: 100%;
  height: 148px;
  object-fit: cover;
  border-radius: 10px;
}

.msg.is-jump .msg-bubble,
.msg-bubble.is-jump {
  animation: msg-flash 1.1s ease;
}

.chat-avatar img,
.chat-avatar .chat-avatar-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: inherit;
  object-fit: cover;
  object-position: center;
}

.chat-dot {
  z-index: 1;
}

.chat-item .hcs-chat__unread {
  align-self: center;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  margin-left: auto;
  min-width: 1.25rem;
  padding: 0.1rem 0.4rem;
  text-align: center;
}

.chat-compose {
  flex-wrap: wrap;
}

.chat-compose-banner,
.chat-compose-files,
.hcs-chat__composer-error {
  flex: 1 0 100%;
}

.chat-compose-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #F0FDFA;
  color: var(--color-gray-700);
}

.chat-compose-banner strong {
  font-size: 11px;
  color: var(--color-primary-active, #0F7A70);
}

.chat-compose-banner p {
  margin: 2px 0 0;
  font-size: 12px;
}

.chat-compose-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 8px 6px 6px;
  border-radius: 10px;
  background: var(--color-gray-50);
  font-size: 12px;
}

.chat-file-chip span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-file-chip .chat-thumb-ext {
  width: 28px;
  height: 32px;
  font-size: 8px;
}

.chat-file-chip .icon-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
}

.chat-input-wrap textarea {
  flex: 1;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  height: 44px;
  max-height: 120px;
  padding: 10px 0;
  background: transparent;
  color: var(--color-foreground);
  resize: none;
  font: inherit;
  box-shadow: none;
}

.chat-input-wrap textarea:focus {
  outline: none;
}

@keyframes chat-spin {
  to { transform: rotate(360deg); }
}

.chat-spin {
  animation: chat-spin 0.8s linear infinite;
}

.hcs-chat__empty svg {
  color: var(--color-primary);
}

.hcs-chat__new-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px 4px;
}

.hcs-chat__new-heading h2 {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-gray-800);
}

.chat-shell:has(.hcs-chat__connection) {
  grid-template-rows: auto minmax(0, 1fr);
}

.hcs-chat__connection {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--color-gray-200, #E2E8F0);
  border-radius: 12px;
  background: var(--color-white, #fff);
  color: var(--color-gray-700, #334155);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.hcs-chat__connection-mark {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: currentColor;
}

.hcs-chat__connection-text {
  min-width: 0;
}

.hcs-chat__connection--reconnecting {
  border-color: #D5EDEA;
  background: #F4FBFA;
  color: var(--color-primary-active, #0F766E);
}

.hcs-chat__connection--reconnecting .hcs-chat__connection-mark {
  animation: hcs-chat-connection-pulse 1.6s ease-in-out infinite;
}

.hcs-chat__connection--offline {
  border-color: #F3E6D0;
  background: #FFFBF5;
  color: #92400E;
}

.hcs-chat__connection--restored {
  border-color: #D7F0E3;
  background: #F3FBF7;
  color: #166534;
}

.page-chat button.hcs-chat__connection-action,
.hcs-app-shell .page-chat button.hcs-chat__connection-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--color-primary, #007f7c);
  box-shadow: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.page-chat button.hcs-chat__connection-action:hover:not(:disabled),
.hcs-app-shell .page-chat button.hcs-chat__connection-action:hover:not(:disabled) {
  background: var(--color-primary-hover, #0f766e);
}

.page-chat button.hcs-chat__connection-action:disabled,
.hcs-app-shell .page-chat button.hcs-chat__connection-action:disabled {
  opacity: 0.72;
  cursor: default;
}

@keyframes hcs-chat-connection-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .hcs-chat__connection--reconnecting .hcs-chat__connection-mark {
    animation: none;
  }
}

.hcs-chat__pinned-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px 12px;
  border-bottom: 1px solid var(--color-gray-100);
  background: #F0FDFA;
}

.hcs-chat__pinned-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

.hcs-chat__pinned-item:hover {
  background: #DDF7F3;
}

.hcs-chat__pinned-item strong {
  font-size: 11px;
  color: var(--color-primary-active, #0F7A70);
}

.hcs-chat__pinned-item span {
  max-width: 100%;
  overflow: hidden;
  color: var(--color-gray-700);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hcs-chat__older {
  align-self: center;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  color: var(--color-primary);
  font-size: 12px;
}

.hcs-chat__older:hover {
  background: var(--color-primary-soft);
}

.hcs-chat__reload {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  color: var(--color-primary, #007f7c);
}

.chat-rename-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 280px;
}

.chat-info-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.chat-info-section-head h3 {
  margin: 0;
}

.chat-info-section-head .btn {
  flex-shrink: 0;
}

.hcs-chat__rename {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.chat-media-grid img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-overlay.is-open {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  align-items: center;
  justify-items: center;
  padding: 24px 16px;
  z-index: var(--hcs-z-modal, var(--z-modal, 90));
}

.chat-preview-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0;
  width: min(96vw, 88rem);
  max-height: min(94vh, 1100px);
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.chat-preview-pdf {
  height: min(86vh, 980px);
  min-height: 32rem;
  background: var(--color-gray-50);
}

.chat-preview-pdf .hcs-pdf-frame--fill,
.chat-preview-pdf .hcs-pdf-frame__viewport,
.chat-preview-pdf .hcs-pdf-frame__sheet,
.chat-preview-pdf .hcs-pdf-frame__embed {
  height: 100%;
}

.chat-preview-dialog img,
.chat-preview-frame {
  display: block;
  width: 100%;
  height: min(86vh, 980px);
  max-height: min(86vh, 980px);
  object-fit: contain;
  background: var(--color-gray-50);
  border: 0;
}

.chat-preview-note {
  margin: 0;
  padding: 2rem 1.5rem;
  color: var(--color-gray-700, #334155);
  text-align: center;
}

.chat-shell.is-info-open.chat-shell--compact-info {
  grid-template-columns: 280px minmax(0, 1fr) 300px;
}

.chat-info--compact .chat-info-head {
  padding: 8px 12px 2px;
}

.chat-info--compact .chat-info-kicker {
  font-size: var(--font-size-sm);
}

.chat-info--compact .chat-info-body {
  padding: 2px 12px 12px;
}

.chat-info--compact .chat-info-profile {
  gap: 0;
  padding: 0 0 4px;
}

.chat-info--compact .chat-avatar.lg {
  width: 44px;
  height: 44px;
  min-width: 44px;
  font-size: 14px;
}

.chat-info--compact .chat-avatar.lg .chat-dot {
  width: 8px;
  height: 8px;
  right: 0;
  bottom: 1px;
}

.chat-info--compact .chat-name-btn {
  min-height: 28px;
  padding: 0 6px;
  font-size: var(--font-size-sm);
}

.chat-info--compact .chat-name-btn svg {
  width: 12px;
  height: 12px;
}

.chat-info--compact .hcs-chat__info-type {
  font-size: 11px;
}

.chat-info--compact .chat-info-actions {
  margin-bottom: 8px;
}

.chat-info--compact .chat-info-actions .btn {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
}

.chat-info--compact .chat-info-section {
  margin-bottom: 8px;
}

.chat-info--compact .chat-info-section h3,
.chat-info--compact .chat-info-section-head {
  margin-bottom: 4px;
}

.chat-info--compact .chat-member-list {
  gap: 2px;
}

.chat-info--compact .chat-member {
  min-height: 28px;
  gap: 8px;
}

.chat-info--compact .chat-pin-info {
  min-height: 30px;
  padding: 4px 8px;
}

.chat-info--compact .chat-media-tabs {
  margin-bottom: 6px;
}

.chat-info--compact .chat-media-tab {
  min-height: 28px;
  font-size: 12px;
}

.chat-info--compact .chat-media-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.chat-info--compact .chat-media-grid.is-files {
  grid-template-columns: 1fr;
  gap: 4px;
}

.chat-info--compact .chat-thumb {
  border-radius: 6px;
}

.chat-info--compact .chat-thumb-file {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  aspect-ratio: auto;
  min-height: 32px;
  padding: 4px 8px;
}

.chat-info--compact .chat-thumb-ext {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  box-sizing: border-box;
  width: 36px;
  height: 22px;
  padding: 0;
  border-radius: 4px;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}

.chat-info--compact .chat-thumb-name {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  text-align: left;
}

.chat-info--compact .chat-thumb-dl {
  width: 20px;
  height: 20px;
  top: 3px;
  right: 3px;
}

.chat-info--compact .chat-media-empty {
  padding: 6px 4px;
}
