.chat-main {
  max-width: 1600px;
  margin: auto;
  padding: 32px var(--gutter) 0;
}
.chat-page-title {
  display: flex;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.chat-page-title .eyebrow {
  display: none;
}
.chat-page-title h1 {
  font-size: 2.25rem;
  margin: 0;
}
.chat-page-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.service-status {
  color: var(--muted);
  font-size: 0.9rem;
}
.service-status:empty {
  display: none;
}
.service-status[data-state="error"] {
  padding: 20px;
  border: 1px solid var(--control-border);
}
.message-sender {
  font-size: 0.73rem;
  color: var(--accent);
  margin-bottom: 6px;
}
.gate {
  display: block;
  max-width: 850px;
  padding: 64px 0 100px;
  margin: 32px auto 0;
  border-top: 1px solid var(--line);
}
.gate h2 {
  font-size: clamp(2.25rem, 4.5vw, 4rem);
  font-weight: 400;
}
.gate > p {
  color: var(--muted);
  max-width: 55ch;
}
.gate > p:last-child {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 32px;
}
.wrap {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: var(--chat-height, calc(100dvh - 240px));
  min-height: 400px;
  max-height: 1000px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
}
.aside {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  gap: 24px;
}
.tab {
  min-height: 54px;
  padding: 8px 0;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
}
.tab.active {
  border-bottom-color: var(--accent);
  color: var(--text);
}
.pane {
  display: none;
  overflow-y: auto;
  min-height: 0;
  padding: 0 16px 24px;
}
.pane.active {
  display: block;
}
.list-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 24px 0 16px;
}
.title {
  font-weight: 500;
  font-size: 1rem;
  overflow-wrap: anywhere;
  min-width: 0;
}
.pill,
.badge {
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 3px 7px;
  white-space: normal;
}
.search {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.search input {
  flex: 1 1 130px;
  font-size: 0.85rem;
  padding: 10px;
}
.search .btn {
  padding: 10px;
  font-size: 0.75rem;
}
.pane .mini {
  font-size: 0.71rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
#roomSearchStatus,
#searchStatus {
  padding: 12px 0;
}
.sectiontitle {
  font-size: 0.73rem;
  color: var(--muted);
  margin: 24px 0 12px;
  letter-spacing: 0.04em;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
}
.row > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}
.row .name {
  font-size: 0.85rem;
}
.row.room {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  min-height: 62px;
}
.row.room:hover,
.row.room.active {
  background: var(--surface-raised);
}
.row.room.active {
  box-shadow: inset 2px 0 var(--accent);
}
.row .actbtn {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.actbtn .btn {
  font-size: 0.7rem;
  padding: 8px;
}
.dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--control-border);
}
.dot.on {
  background: var(--success);
}
.dot.channel {
  border-radius: 0;
  background: var(--muted);
}
.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
  background: var(--bg);
}
.chat-hd {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  min-height: 88px;
}
.chat-hd .title {
  flex: 1 1 150px;
}
.chat-hd .btn {
  font-size: 0.73rem;
  padding: 8px 12px;
  min-height: 40px;
}
.chat-hd #status {
  font-size: 0.7rem;
  flex-basis: 100%;
  order: 9;
}
.chat-hd #memberTag {
  display: none;
}
.chat-toggle {
  display: none;
}
.thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.day {
  text-align: center;
  color: var(--muted);
  font-size: 0.68rem;
  margin: 16px 0 24px;
}
.msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 24px;
}
.avatar,
.bigavatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 0.72rem;
  color: var(--accent);
}
.bigavatar {
  width: 60px;
  height: 60px;
  font-size: 1.1rem;
  margin-bottom: 16px;
}
.msg-body {
  min-width: 0;
  max-width: 75ch;
}
.bubble {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
  line-height: 1.65;
}
.msg.me .bubble {
  color: var(--text);
}
.bubble.deleted {
  font-style: italic;
  color: var(--muted);
}
.meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.65rem;
}
.msg-actions {
  display: flex;
  gap: 10px;
}
.action-btn,
.mini-btn {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  min-height: 32px;
  padding: 4px;
}
.action-btn:hover {
  color: var(--text);
}
.action-btn.delete {
  color: var(--danger);
}
.edit-input {
  min-width: 240px;
}
.edit-actions {
  display: flex;
  gap: 16px;
}
.jump-latest {
  display: none;
  position: absolute;
  bottom: 150px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 10px 18px;
  font-size: 0.8rem;
  box-shadow: 0 6px 30px #0008;
  white-space: nowrap;
}
.jump-latest.show {
  display: block;
}
.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 16px 20px;
  background: var(--surface);
  align-items: end;
}
.composer textarea {
  min-height: 60px;
  max-height: 180px;
  resize: none;
  font-size: 0.95rem;
}
.composer.expanded textarea {
  min-height: 160px;
}
.composer .btn {
  font-size: 0.78rem;
  padding: 10px 14px;
}
.composer-status {
  grid-column: 1/-1;
  font-size: 0.66rem;
  min-height: 1.5em;
}
.call-area {
  display: none;
  padding: 12px;
  background: var(--surface);
  max-height: 40%;
  overflow: auto;
}
.call-bar {
  font-size: 0.8rem;
  min-height: 44px;
}
.call-media {
  display: flex;
  gap: 10px;
}
.call-media video {
  width: 48%;
  max-height: 220px;
  object-fit: contain;
  background: #000;
}
.details .hd {
  font-size: 1.4rem;
}
.details .card {
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}
.details .kv {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 16px;
  font-size: 0.86rem;
  padding: 8px 0;
}
.details .k {
  color: var(--muted);
}
.details .v {
  overflow-wrap: anywhere;
}
.details .sectiontitle {
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 32px;
}
.details .mini {
  overflow-wrap: anywhere;
}
body[data-page="chat"] .site-footer {
  margin-top: 48px;
}
@media (max-width: 1100px) {
  .chat-main {
    padding-inline: 24px;
  }
  .wrap {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .chat-hd {
    gap: 8px;
    padding: 14px;
  }
  .chat-hd .title {
    flex-basis: 120px;
  }
  .thread {
    padding: 20px;
  }
  .composer {
    padding: 12px;
  }
}
@media (max-width: 700px) {
  .chat-main {
    padding: 24px 16px 0;
  }
  .chat-page-title {
    gap: 8px;
    margin-bottom: 20px;
  }
  .chat-page-title p {
    font-size: 0.8rem;
  }
  .chat-page-title h1 {
    font-size: 1.7rem;
  }
  .wrap {
    display: block;
    min-height: 260px;
  }
  .aside {
    height: 100%;
    border: 0;
    display: none;
  }
  .aside.open {
    display: flex;
  }
  .chat {
    height: 100%;
  }
  .aside.open + .chat {
    display: none;
  }
  .chat-toggle {
    display: inline-flex;
  }
  .chat-hd .title {
    flex-basis: calc(100% - 120px);
  }
  .chat-hd #callControls {
    margin-left: 0 !important;
  }
  .chat-hd #status {
    flex-basis: auto;
    flex: 1;
    order: 0;
  }
  .chat-hd #detailsToggle {
    margin-left: auto;
  }
  .thread {
    padding: 16px 12px;
  }
  .composer {
    grid-template-columns: 1fr auto;
  }
  .composer textarea {
    grid-column: 1/-1;
    min-height: 56px;
  }
  .composer #expand {
    justify-self: start;
    min-height: 38px;
  }
  .composer #send {
    min-width: 80px;
    min-height: 38px;
  }
  .composer-status {
    font-size: 0.75rem;
  }
  .jump-latest {
    bottom: 175px;
  }
  .gate {
    padding-top: 36px;
    padding-bottom: 48px;
  }
  .gate h2 {
    font-size: 2.2rem;
  }
  .pane {
    padding-inline: 20px;
  }
  .row.room {
    min-height: 64px;
  }
  .search input {
    flex-basis: 170px;
  }
  .details .kv {
    grid-template-columns: 75px minmax(0, 1fr);
  }
  .msg-body {
    max-width: calc(100% - 44px);
  }
  .edit-input {
    min-width: 0;
  }
}
