:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #687789;
  --line: #d8e0ea;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(23, 32, 42, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}
button, input, textarea {
  font: inherit;
}
button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button:hover:not(:disabled) {
  filter: brightness(0.96);
}
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}
textarea {
  min-height: 110px;
  resize: vertical;
}
label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.4em; }
.brand {
  font-weight: 800;
  letter-spacing: 0;
  font-size: 1.35rem;
}
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(15, 118, 110, 0.18), rgba(37, 99, 235, 0.12)),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1800&q=80") center/cover;
}
.auth-shell {
  width: min(1080px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: center;
}
.auth-intro {
  color: #fff;
  text-shadow: 0 2px 22px rgba(0,0,0,.35);
}
.auth-intro h1 {
  max-width: 720px;
  font-size: clamp(2.3rem, 5vw, 5rem);
  line-height: 1;
  margin: 28px 0 18px;
}
.auth-intro p {
  max-width: 620px;
  font-size: 1.15rem;
}
.auth-panel, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.auth-panel {
  padding: 24px;
}
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.tab {
  background: #edf2f7;
  color: var(--ink);
}
.tab.active {
  background: var(--accent);
  color: #fff;
}
.auth-form, .profile-form {
  display: grid;
  gap: 14px;
}
.recaptcha-box {
  margin-top: 14px;
  min-height: 78px;
}
.recaptcha-disabled {
  min-height: auto;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  color: var(--muted);
  font-size: .9rem;
}
.reset-shell {
  grid-template-columns: 1fr .8fr;
}
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}
.sidebar {
  background: #102a43;
  color: #fff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100vh;
  position: sticky;
  top: 0;
  align-self: start;
}
.sidebar .brand {
  margin-bottom: 18px;
}
.nav-button {
  background: transparent;
  color: #d9e2ec;
  text-align: left;
}
.nav-button.active {
  background: #1f4e79;
  color: #fff;
}
.nav-button.danger {
  margin-top: auto;
  color: #ffd2cc;
}
.sidebar-status {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d9e2ec;
  font-size: .9rem;
}
.main {
  padding: 24px;
  min-width: 0;
  overflow-x: hidden;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.topbar h1 {
  margin: 0;
  font-size: 1.8rem;
}
.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.user-chip img, .avatar {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
}
.view { display: none; }
.view.active { display: block; }
.split {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 18px;
}
.panel {
  padding: 18px;
}
.panel-header, .chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.panel h2, .chat-header h2 {
  margin: 0;
  font-size: 1.15rem;
}
.button-row, .inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.secondary-btn {
  background: #edf2f7;
  color: var(--ink);
}
.inline-form input {
  min-width: 190px;
}
.search-input {
  margin-bottom: 12px;
}
.select-input {
  min-width: 100px;
}
.user-list {
  display: grid;
  gap: 10px;
}
.user-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
}
.user-card.active {
  outline: 2px solid var(--accent);
}
.presence-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #a0aec0;
}
.presence-dot.online { background: #16a34a; }
.presence-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .82rem;
}
.messages {
  height: 52vh;
  min-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.messages.compact {
  height: 260px;
}
.empty-state {
  margin: auto;
  max-width: 420px;
  text-align: center;
  color: var(--muted);
  padding: 24px 12px;
}
.empty-state strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
}
.empty-state p {
  margin: 0 0 8px;
}
.empty-state span {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--muted);
  font-size: .85rem;
}
.feature-copy {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #f8fafc;
}
.feature-copy strong {
  display: block;
  margin-bottom: 6px;
}
.feature-copy p {
  margin: 0;
  color: var(--muted);
}
.room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 18px;
}
.room-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.room-info {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}
.room-info strong {
  color: var(--ink);
}
.reaction-feed {
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.reaction-pop {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff7ed;
  color: #7c2d12;
  font-size: .9rem;
  transition: opacity .25s ease;
}
.emoji-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}
.emoji-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  font-size: 1.05rem;
}
.reaction-pop.soft {
  opacity: .72;
}
.participants-panel h2 {
  margin-top: 0;
}
.participant-list {
  display: grid;
  gap: 10px;
}
.participant {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}
.participant span {
  display: grid;
  gap: 2px;
}
.participant small {
  color: var(--muted);
}
.message {
  max-width: min(72%, 620px);
  padding: 9px 11px;
  border-radius: 8px;
  background: #e6fffb;
  align-self: flex-start;
  overflow-wrap: anywhere;
}
.message.mine {
  background: #dbeafe;
  align-self: flex-end;
}
.message small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}
.message-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}
.check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
}
.check input {
  width: auto;
}
.profile-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.profile-card {
  padding: 0;
  overflow: hidden;
  text-align: center;
}
.profile-cover {
  height: 120px;
  background:
    linear-gradient(135deg, rgba(15,118,110,.95), rgba(37,99,235,.86)),
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.3), transparent 36%);
}
.profile-avatar-large {
  width: 112px;
  height: 112px;
  border-radius: 18px;
  object-fit: cover;
  border: 4px solid #fff;
  margin-top: -56px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(16, 42, 67, .18);
}
.profile-card h2 {
  margin: 12px 18px 6px;
  font-size: 1.35rem;
}
.profile-card p {
  margin: 0 auto;
  max-width: 280px;
  padding: 0 18px;
  color: var(--muted);
}
.profile-meta {
  display: grid;
  gap: 8px;
  padding: 18px;
  margin-top: 12px;
}
.profile-meta span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fafc;
  color: var(--ink);
  font-size: .92rem;
}
.profile-editor .panel-header p {
  margin: 4px 0 0;
}
.enhanced-profile-form {
  gap: 18px;
}
.avatar-upload {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}
.avatar-upload img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
}
.avatar-upload p {
  margin: 4px 0 10px;
  color: var(--muted);
}
.file-button {
  display: inline-flex;
  width: auto;
  background: #edf2f7;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 700;
}
.file-button input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}
.field-group {
  display: grid;
  gap: 8px;
}
.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.status-chips button {
  background: #e6fffb;
  color: #134e4a;
  border: 1px solid #99f6e4;
  padding: 8px 10px;
}
.field-footer {
  display: flex;
  justify-content: flex-end;
  color: var(--muted);
  font-size: .86rem;
}
.privacy-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}
.privacy-box p {
  margin: 4px 0 0;
}
.switch {
  display: inline-flex;
  width: auto;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.switch span {
  width: 54px;
  height: 30px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  transition: background .2s ease;
}
.switch span::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  transition: transform .2s ease;
}
.switch input:checked + span {
  background: var(--accent);
}
.switch input:checked + span::before {
  transform: translateX(24px);
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.form-actions p {
  margin: 0;
}
.form-actions button {
  min-width: 180px;
}
.call-overlay {
  position: fixed;
  inset: 0;
  background: #07111f;
  color: #fff;
  z-index: 10;
  display: grid;
  grid-template-rows: auto 1fr;
}
.call-overlay.room-mode {
  background: #08131f;
}
.call-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 9px 12px;
  background: rgba(2, 8, 23, .78);
  border-bottom: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(10px);
}
.call-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.call-title {
  font-weight: 800;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(36vw, 420px);
}
.call-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #dbeafe;
  background: rgba(37, 99, 235, .16);
  border: 1px solid rgba(147, 197, 253, .2);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .88rem;
  font-weight: 700;
  white-space: nowrap;
}
.call-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #60a5fa;
}
.call-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.call-toolbar .secondary-btn {
  background: #1f2937;
  color: #fff;
}
.toolbar-btn {
  min-width: 64px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
  background: #0f766e;
}
.toolbar-btn.is-off {
  background: #334155;
  color: #fecaca;
}
.toolbar-btn.is-on {
  background: #2563eb;
}
.danger-btn {
  background: var(--danger);
}
.call-stage {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 10px;
  position: relative;
}
.call-overlay.room-mode .call-stage {
  grid-template-columns: minmax(0, 1fr) 360px;
}
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  min-height: 0;
}
.video-tile {
  position: relative;
  min-height: 260px;
  background: #000;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  overflow: hidden;
}
.call-overlay.room-mode .video-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-content: start;
}
.call-overlay.room-mode .video-tile {
  min-height: 360px;
}
video {
  width: 100%;
  height: 100%;
  min-height: 260px;
  background: #000;
  object-fit: cover;
}
.video-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(7, 17, 31, .72);
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .88rem;
  font-weight: 700;
}
.room-dock {
  min-height: 0;
  overflow: auto;
  background: #f8fafc;
  color: var(--ink);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 14px;
}
.dock-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.dock-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.dock-section h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}
.dock-section p {
  margin: 0;
  color: var(--muted);
}
.dock-reactions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.dock-reactions .reaction-btn,
.room-actions .reaction-btn,
.guest-reaction {
  min-width: 44px;
  background: #0f766e;
}
.dock-messages {
  height: 210px;
}
.compact-list .participant {
  padding: 8px;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(7, 17, 31, .58);
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal-panel {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.modal-panel h2 {
  margin: 0 0 8px;
}
.modal-panel p {
  margin: 0 0 18px;
  color: var(--muted);
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 36px));
  background: #102a43;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.toast.error {
  background: var(--danger);
}
.guest-page {
  min-height: 100vh;
  background: var(--bg);
}
.guest-shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 28px 0;
}
.guest-join {
  width: min(480px, 100%);
  margin: 10vh auto 0;
}
.guest-join h1 {
  margin: 18px 0 8px;
  font-size: 2rem;
}
.guest-room {
  display: block;
}
.guest-video-grid {
  min-height: 340px;
  background: #07111f;
  border-radius: 8px;
  margin-bottom: 12px;
}
.floating-reactions {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}
.floating-reaction {
  position: absolute;
  bottom: 16%;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.35));
  animation: floatReaction 1.9s ease-out forwards;
}
@keyframes floatReaction {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(.8);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-190px) scale(1.25);
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 210px 1fr;
  }
  .split {
    grid-template-columns: 300px minmax(0, 1fr);
  }
  .call-overlay.room-mode .call-stage {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
  .room-dock {
    padding: 12px;
  }
  .dock-reactions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .auth-shell {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 22px 0;
  }
  .auth-intro h1 {
    font-size: 2.6rem;
    max-width: 720px;
  }
  .split, .room-layout, .profile-grid {
    grid-template-columns: 1fr;
  }
  .user-list-panel {
    max-height: 320px;
    overflow: auto;
  }
  .messages {
    height: 44vh;
  }
  .call-overlay.room-mode .call-stage {
    grid-template-columns: 1fr;
  }
  .room-dock {
    max-height: 40vh;
  }
  .call-overlay.room-mode .video-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

@media (max-width: 840px) {
  .auth-shell, .app-shell, .split, .room-layout, .profile-grid {
    grid-template-columns: 1fr;
  }
  .app-shell {
    align-items: start;
    min-height: 0;
  }
  .auth-shell {
    padding: 24px 0;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    align-self: start;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px;
    gap: 8px;
  }
  .main {
    align-self: start;
  }
  .sidebar .brand {
    width: 100%;
    margin-bottom: 4px;
  }
  .nav-button.danger {
    margin-top: 0;
  }
  .nav-button {
    padding: 9px 11px;
  }
  .sidebar-status {
    margin-top: 0;
    padding: 8px 10px;
  }
  .main {
    padding: 14px;
  }
  .topbar {
    align-items: flex-start;
  }
  .messages {
    height: 46vh;
  }
  .button-row, .inline-form {
    flex-wrap: wrap;
  }
  .chat-header, .panel-header, .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .user-chip {
    align-self: flex-start;
  }
  .message-form {
    grid-template-columns: 1fr;
  }
  .privacy-box, .form-actions, .avatar-upload {
    align-items: stretch;
    flex-direction: column;
  }
  .form-actions button {
    width: 100%;
  }
  .call-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .call-meta, .call-actions {
    width: 100%;
  }
  .call-meta {
    flex-wrap: wrap;
    gap: 8px;
  }
  .call-actions {
    justify-content: stretch;
  }
  .toolbar-btn {
    flex: 1 1 88px;
  }
  .call-overlay.room-mode .call-stage {
    grid-template-columns: 1fr;
  }
  .call-overlay.room-mode .video-tile {
    min-height: 260px;
  }
  .room-dock {
    max-height: 42vh;
  }
}

@media (max-width: 640px) {
  button {
    padding: 9px 11px;
  }
  .auth-page {
    place-items: start;
  }
  .auth-shell {
    width: min(100%, calc(100vw - 20px));
  }
  .auth-intro {
    padding-top: 8px;
  }
  .auth-intro h1 {
    font-size: 2rem;
    line-height: 1.05;
    margin: 18px 0 12px;
  }
  .auth-intro p {
    font-size: 1rem;
  }
  .auth-panel, .panel {
    box-shadow: none;
  }
  .sidebar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    row-gap: 8px;
    column-gap: 6px;
    padding: 10px;
  }
  .sidebar .brand {
    grid-column: 1 / -1;
    width: auto;
    margin-bottom: 2px;
    font-size: 1.15rem;
  }
  .nav-button {
    text-align: center;
    white-space: nowrap;
    padding: 9px 6px;
    font-size: .9rem;
  }
  .sidebar-status {
    grid-column: span 3;
    justify-content: center;
    min-height: 34px;
  }
  .nav-button.danger {
    grid-column: span 2;
    color: #ffd2cc;
  }
  .main {
    padding: 10px;
  }
  .topbar h1 {
    font-size: 1.45rem;
  }
  .user-chip {
    max-width: 100%;
    padding: 7px 8px;
  }
  .user-chip img,
  .avatar {
    width: 34px;
    height: 34px;
  }
  .panel {
    padding: 12px;
  }
  .panel-header, .chat-header {
    gap: 10px;
  }
  .button-row, .inline-form {
    width: 100%;
    gap: 7px;
  }
  .button-row > *, .inline-form > * {
    flex: 1 1 auto;
  }
  .inline-form input {
    min-width: 0;
  }
  .user-card {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 9px;
    align-items: start;
  }
  .user-card > span:not(.presence-label) {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: left;
  }
  .presence-label {
    grid-column: 2;
    margin-top: -4px;
  }
  .message {
    max-width: 88%;
  }
  .messages {
    min-height: 240px;
    height: 40vh;
  }
  .messages.compact, .dock-messages {
    height: 230px;
  }
  .call-toolbar {
    min-height: 0;
    gap: 8px;
    padding: 8px;
  }
  .call-title {
    max-width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }
  .call-status {
    width: fit-content;
    max-width: 100%;
  }
  .call-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .toolbar-btn {
    min-width: 0;
    width: 100%;
  }
  .call-stage {
    padding: 8px;
  }
  .video-grid, .call-overlay.room-mode .video-grid {
    grid-template-columns: 1fr;
  }
  .video-tile, .call-overlay.room-mode .video-tile {
    min-height: 46vh;
  }
  .room-dock {
    max-height: 46vh;
  }
  .dock-reactions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .profile-cover {
    height: 86px;
  }
  .profile-avatar-large {
    width: 88px;
    height: 88px;
    margin-top: -44px;
  }
  .profile-card h2 {
    margin-top: 10px;
  }
  .profile-card p {
    padding: 0 14px;
  }
  .profile-meta {
    padding: 14px;
  }
  .avatar-upload img {
    width: 60px;
    height: 60px;
  }
  .status-chips button {
    flex: 1 1 140px;
  }
  .guest-shell {
    width: min(100%, calc(100vw - 20px));
    padding: 10px 0;
  }
  .guest-video-grid {
    min-height: 260px;
  }
}

@media (max-width: 420px) {
  .sidebar {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .sidebar-status {
    grid-column: span 3;
  }
  .nav-button {
    font-size: .84rem;
    padding-inline: 4px;
  }
  .nav-button.danger {
    grid-column: span 2;
  }
  .call-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dock-reactions {
    grid-template-columns: 1fr;
  }
  .message {
    max-width: 94%;
  }
}
