:root {
  color-scheme: dark;
  --bg: #171615;
  --panel: #22201d;
  --panel-2: #2d2924;
  --panel-3: #37312a;
  --line: #4a4339;
  --text: #f4efe6;
  --muted: #b8aa98;
  --honey: #d99a23;
  --teal: #2a9d8f;
  --berry: #c44569;
  --danger: #e15b4f;
  --ok: #5c946e;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes softPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(42, 157, 143, 0); }
  50% { box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.16); }
}

.button-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.button-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button .button-icon + span,
.primary .button-icon + span {
  margin-left: 7px;
}

.auth-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: #77d5c9;
}

.auth-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(217, 154, 35, 0.16), transparent 30%),
    linear-gradient(315deg, rgba(42, 157, 143, 0.16), transparent 32%),
    var(--bg);
}

.auth-card {
  width: min(920px, 100%);
  background: rgba(34, 32, 29, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.auth-card.compact {
  width: min(420px, 100%);
}

.brand-lockup {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark,
.avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--honey);
  color: #171615;
  font-weight: 900;
}

.brand-lockup h1,
.brand-lockup p,
.server-header h2,
.server-header p,
.chat-header h2,
.chat-header p {
  margin: 0;
}

.brand-lockup h1 {
  font-size: 30px;
  line-height: 1.1;
}

.brand-lockup p,
.server-header p,
.chat-header p {
  color: var(--muted);
  font-size: 13px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.panel,
.admin-block,
.modal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.panel {
  padding: 18px;
}

.panel h2,
.modal-card h2,
.admin-panel h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  color: var(--text);
  background: #171615;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.18);
}

.panel label + label,
.modal-card label + label,
.admin-block label + label {
  margin-top: 12px;
}

.primary,
.panel button,
.modal-card button,
.admin-block button,
.search-box button,
.composer button {
  min-height: 38px;
  border-radius: 6px;
  background: var(--teal);
  color: #071311;
  font-weight: 800;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.primary.honey {
  background: var(--honey);
  color: #171615;
}

.panel button,
.modal-card button {
  width: 100%;
  margin-top: 16px;
}

.danger {
  background: var(--danger) !important;
  color: #fff !important;
}

.app-shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 280px minmax(360px, 1fr);
  overflow: hidden;
}

.channel-pane,
.member-pane {
  min-height: 0;
  border-right: 1px solid var(--line);
}

.guild-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  background: #11100f;
}

.guild-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  overflow-y: auto;
}

.guild-button,
.rail-action,
.icon-button,
.tiny {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--text);
  border-radius: 8px;
  background: var(--panel-2);
}

.guild-button {
  width: 52px;
  height: 52px;
  margin: 0 auto;
  background: var(--guild-color, var(--panel-2));
  color: #171615;
  font-weight: 900;
}

.guild-button.home {
  background: var(--honey);
}

.guild-button.active {
  outline: 3px solid rgba(244, 239, 230, 0.22);
}

.rail-action {
  width: 44px;
  height: 44px;
  color: var(--text);
  font-weight: 900;
}

.guild-button .button-icon,
.rail-action .button-icon,
.icon-button .button-icon,
.tiny .button-icon {
  width: 18px;
  height: 18px;
}

.channel-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--panel);
}

.server-header,
.chat-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.server-header h2,
.chat-header h2 {
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.icon-button,
.tiny {
  width: 32px;
  height: 32px;
  background: var(--panel-3);
  color: var(--text);
  font-weight: 900;
}

.tiny {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.channel-section {
  padding: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.channel-button {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
  padding: 7px 9px;
  text-align: left;
}

.channel-button strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-button:hover,
.channel-button.active {
  color: var(--text);
  background: var(--panel-3);
}

.channel-wrap {
  position: relative;
  border-radius: 6px;
}

.channel-wrap.active {
  background: rgba(255, 255, 255, 0.025);
}

.channel-button em {
  min-width: 22px;
  min-height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--teal);
  color: #071311;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.voice-roster {
  display: grid;
  gap: 4px;
  padding: 2px 6px 8px 34px;
}

.voice-ghost-button {
  position: absolute;
  right: 6px;
  top: 5px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
  z-index: 2;
}

.channel-wrap:hover .voice-ghost-button,
.voice-ghost-button.active {
  opacity: 1;
}

.voice-ghost-button:hover,
.voice-ghost-button.active {
  background: var(--panel-3);
  color: var(--honey);
}

.channel-wrap:has(.voice-ghost-button) .channel-button {
  padding-right: 40px;
}

.voice-dock.ghost {
  border-left: 3px solid var(--honey);
}

.ghost-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(217, 154, 35, 0.45);
  border-radius: 6px;
  background: rgba(217, 154, 35, 0.12);
  color: var(--honey);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.ghost-stage .video-grid:empty::before {
  content: "Listening for people in this voice channel";
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.voice-roster-user {
  min-height: 28px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.voice-roster-user span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-roster-user .button-icon {
  width: 14px;
  height: 14px;
}

.voice-roster-user.speaking {
  border-radius: 6px;
  outline: 2px solid var(--honey);
  outline-offset: 1px;
  background: rgba(217, 154, 35, 0.12);
  color: var(--text);
}


.avatar.mini {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 10px;
}

.voice-dock {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 12px;
  background: #1a1816;
}

.voice-dock > div:first-child {
  display: grid;
  gap: 2px;
  margin-bottom: 10px;
}

.voice-dock strong {
  font-size: 14px;
}

.voice-dock span {
  color: var(--muted);
  font-size: 12px;
}

.voice-dock.connected {
  border-left: 3px solid var(--teal);
}

.dock-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dock-ring {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 6px;
  margin-top: 8px;
}

.dock-ring .ring-select {
  min-width: 0;
  height: 32px;
  padding: 0 7px;
}

.dock-ring .icon-button {
  width: 32px;
  height: 32px;
}

.dock-actions .icon-button.active {
  background: var(--honey);
  color: #171615;
}

.chat-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #1d1b19;
}

.chat-pane.call-only {
  overflow: hidden;
}

.chat-pane.call-only .call-window {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-bottom: 0;
}

.chat-pane.call-only .voice-stage {
  min-height: 0;
  overflow: auto;
}

.call-pane {
  grid-template-rows: auto minmax(0, 1fr);
  background: #121110;
}

.call-window {
  border-bottom: 1px solid var(--line);
  background: #141311;
  animation: slideIn 0.18s ease;
}

.call-window-header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.call-window-header > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.call-window-header strong,
.call-window-header span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-window-header span {
  color: var(--muted);
  font-size: 12px;
}

.call-window .voice-stage {
  border-bottom: 0;
  background: #11100f;
}

.call-window.collapsed .call-window-header {
  border-bottom: 0;
}

.quality-select {
  width: auto;
  height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--panel-3);
}

.video-tile {
  animation: slideIn 0.2s ease;
}

.video-tile.focused {
  grid-column: 1 / -1;
  min-height: clamp(360px, 52vw, 820px);
  animation: softPulse 1.4s ease-in-out infinite;
}

.video-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.video-tile:hover .video-actions,
.video-tile:focus-within .video-actions {
  opacity: 1;
}

.video-actions .icon-button {
  width: 30px;
  height: 30px;
  background: rgba(17, 16, 15, 0.82);
}

.peer-menu {
  position: fixed;
  z-index: 40;
  width: 250px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  box-shadow: var(--shadow);
  padding: 12px;
  animation: slideIn 0.14s ease;
}

.peer-menu strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.peer-menu label {
  gap: 8px;
}

.peer-menu input[type="range"] {
  padding: 0;
}

.peer-menu button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  border-radius: 6px;
  background: var(--panel-3);
  color: var(--text);
  padding: 0 10px;
  text-align: left;
}

.call-header {
  align-items: center;
}

.call-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.call-actions .icon-button.active {
  background: var(--honey);
  color: #171615;
}

.call-stage {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.call-stage .voice-stage {
  min-height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
}

.call-stage .stage-header {
  min-height: 34px;
  align-items: center;
}

.call-stage .video-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr));
  align-content: start;
}

.call-stage .video-tile {
  min-height: clamp(260px, 32vw, 680px);
}

.search-box {
  display: grid;
  grid-template-columns: minmax(120px, 210px) auto;
  gap: 8px;
}

.search-box input {
  height: 38px;
}

.search-results {
  max-height: 170px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  background: #211f1c;
}

.search-hit {
  width: 100%;
  display: grid;
  grid-template-columns: 90px 130px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  color: var(--text);
  background: transparent;
  text-align: left;
  border-radius: 6px;
  padding: 6px;
}

.search-hit:hover {
  background: var(--panel-3);
}

.search-hit span,
.search-hit em {
  color: var(--muted);
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-stage {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  background: #161514;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 10px;
}

.chat-pane.call-only .video-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(520px, 100%), 1fr));
  align-content: start;
}

.chat-pane.call-only .video-tile {
  min-height: clamp(280px, 30vw, 760px);
}

.video-tile {
  position: relative;
  min-height: 142px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0c0b;
}

.video-tile.speaking {
  border-color: var(--honey);
  box-shadow: 0 0 0 2px rgba(217, 154, 35, 0.45), 0 0 24px rgba(217, 154, 35, 0.18);
}

.video-tile.speaking footer {
  border: 1px solid rgba(217, 154, 35, 0.42);
}


.video-tile video {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
}

.video-tile.screening video {
  object-fit: contain;
  background: #050505;
}

.video-tile:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border-radius: 0;
}

.video-tile:fullscreen video {
  object-fit: contain;
  opacity: 1;
}

.video-tile video.has-video {
  opacity: 1;
}

.video-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--avatar, var(--honey)), #171615);
  color: #fff;
  font-size: clamp(26px, 5vw, 48px);
  font-weight: 900;
  z-index: 0;
}

.video-fallback img {
  width: min(44%, 140px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}


.video-tile footer {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-radius: 6px;
  background: rgba(17, 16, 15, 0.82);
  padding: 6px 8px;
  font-size: 12px;
}

.video-tile footer strong,
.video-tile footer span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.message {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 8px;
}

.message:hover {
  background: rgba(255, 255, 255, 0.035);
}

.avatar {
  background: var(--avatar, var(--honey));
  color: #fff;
  font-size: 13px;
}

.avatar.online {
  box-shadow: 0 0 0 3px rgba(92, 148, 110, 0.38);
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}

.message-body {
  min-width: 0;
}

.message-body header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.message-body header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-body header span,
.message-body header em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  flex: 0 0 auto;
}

.message-body p {
  margin: 4px 0 0;
  color: #efe5d7;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-image {
  display: block;
  max-width: min(520px, 100%);
  max-height: 420px;
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: #0d0c0b;
}

.message-file {
  width: min(420px, 100%);
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
  color: var(--text);
  text-decoration: none;
}

.message-file .button-icon {
  width: 22px;
  height: 22px;
}

.message-file span,
.message-file em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-file em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.message.deleted .message-body p {
  color: #8f8476;
  font-style: italic;
}

.message-actions {
  display: none;
  gap: 6px;
  align-self: start;
}

.message:hover .message-actions {
  display: flex;
}

.message-actions button {
  min-height: 26px;
  border-radius: 6px;
  color: var(--text);
  background: var(--panel-3);
  padding: 0 7px;
  font-size: 12px;
}

.message-actions .button-icon {
  width: 14px;
  height: 14px;
}

.typing-line {
  min-height: 24px;
  color: var(--muted);
  font-size: 12px;
  padding: 0 18px;
}

.composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
}

.attach-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--panel-3);
  color: var(--text);
  cursor: pointer;
}

.attach-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.attachment-name {
  grid-column: 2 / -1;
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer textarea {
  min-height: 42px;
  max-height: 180px;
  resize: none;
  line-height: 1.35;
}

.member-pane {
  min-width: 0;
  overflow-y: auto;
  background: var(--panel);
}

.members-section,
.admin-panel {
  padding: 14px;
}

.member-list {
  display: grid;
  gap: 8px;
}

.member-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 54px;
}

.member-card .avatar {
  width: 38px;
  height: 38px;
}

.member-card strong,
.member-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.member-card .member-status {
  display: flex;
  align-items: center;
  gap: 5px;
}

.member-status .button-icon {
  width: 13px;
  height: 13px;
  color: var(--teal);
}

.role-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.role-pills em {
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  background: color-mix(in srgb, var(--role) 35%, transparent);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  padding: 2px 6px;
}

.admin-panel {
  border-top: 1px solid var(--line);
}

.admin-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.compact-form {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
}

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

.check-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-weight: 600;
  text-transform: none;
}

.check-grid input {
  width: auto;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.list-block,
.admin-output {
  max-height: 220px;
  overflow: auto;
}

.list-row,
.audit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.list-row {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.list-row button {
  min-height: 28px;
  padding: 0 8px;
}

.list-row span,
.audit-row span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty,
.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 140px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.modal-backdrop.show {
  opacity: 1;
}

.modal-close {
  position: absolute;
  inset: 0;
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  padding: 18px;
  box-shadow: var(--shadow);
}

.settings-modal {
  width: min(1120px, calc(100vw - 32px));
  max-height: min(860px, calc(100dvh - 32px));
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.settings-header h2,
.settings-header p {
  margin: 0;
}

.settings-header p {
  color: var(--muted);
  font-size: 13px;
}

.settings-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 14px;
  padding-top: 14px;
}

.settings-members {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.settings-modal .admin-panel {
  padding: 0;
  border-top: 0;
}

.settings-modal .admin-block {
  background: var(--panel-2);
}

.profile-modal {
  display: grid;
  gap: 14px;
}

.profile-preview {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.profile-preview strong,
.profile-preview span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-preview span {
  color: var(--muted);
  font-size: 13px;
}

.avatar.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  font-size: 18px;
}

.device-test {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.device-test header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.device-test header strong,
.settings-version {
  font-size: 12px;
}

.device-test header span,
.settings-version {
  color: var(--muted);
}

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

.profile-modal .device-actions .test-button {
  width: 100%;
  margin-top: 0;
  background: var(--panel-3);
  color: var(--text);
}

.profile-modal .device-actions .test-button.active {
  background: var(--honey);
  color: #171615;
}

.device-test-audio {
  display: none;
}

.camera-test-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 150px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0c0b;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.camera-test-shell video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.camera-test-shell video.has-video {
  opacity: 1;
}

.camera-test-shell.active span {
  opacity: 0;
}

.settings-version {
  text-align: center;
}

.settings-header .icon-button,
.modal-card .icon-button {
  width: 32px;
  min-width: 32px;
  max-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  margin-top: 0;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  background: var(--panel-3);
  color: var(--text);
}

.ring-select {
  width: auto;
  min-width: 118px;
  height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--panel-3);
}

.user-dock {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: #171512;
  padding: 10px 12px;
}

.user-dock strong,
.user-dock span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dock strong {
  font-size: 13px;
}

.user-dock span {
  color: var(--muted);
  font-size: 11px;
}

.settings-logout {
  margin-top: 10px;
}

.client-settings {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.client-settings header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.client-settings header strong,
.client-settings header span {
  font-size: 12px;
}

.client-settings header span {
  color: var(--muted);
}

.settings-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

.settings-toggle input {
  width: auto;
}

.settings-toggle span {
  color: var(--text);
}


.remote-audio-layer {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 36px));
  transform: translateY(10px);
  opacity: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  border-color: rgba(225, 91, 79, 0.55);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 260px minmax(320px, 1fr);
  }
}

@media (max-width: 820px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }

  .app-shell,
  .app-shell.in-call {
    grid-template-columns: minmax(128px, 36vw) minmax(0, 1fr);
    grid-template-rows: 100dvh;
  }

  .channel-pane,
  .app-shell.in-call .channel-pane {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    border-bottom: 0;
    overflow-y: auto;
  }

  .app-shell.in-call .server-header p,
  .app-shell.in-call .section-title span:last-child {
    display: none;
  }

  .app-shell.in-call .channel-section {
    padding: 8px 6px;
  }

  .app-shell.in-call .voice-dock {
    padding: 8px 6px;
  }

  .app-shell.in-call .voice-dock > div:first-child span {
    display: none;
  }

  .app-shell.in-call .dock-actions {
    gap: 4px;
  }

  .app-shell.in-call .dock-ring {
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 4px;
  }

  .app-shell.in-call .dock-ring .ring-select {
    height: 28px;
    font-size: 11px;
  }

  .app-shell.in-call .channel-button {
    grid-template-columns: 18px minmax(0, 1fr);
    padding: 7px 6px;
  }

  .app-shell.in-call .channel-button em {
    display: none;
  }

  .app-shell.in-call .voice-roster {
    padding-left: 24px;
  }

  .app-shell.in-call .voice-roster-user {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .app-shell.in-call .voice-roster-user .button-icon {
    display: none;
  }

  .chat-pane {
    grid-column: 2;
    grid-row: 1;
    min-height: 0;
  }

  .call-pane {
    grid-column: 2;
  }

  .app-shell.in-call .call-pane {
    grid-column: 3;
    grid-row: 1;
  }

  .server-header,
  .chat-header {
    min-height: 56px;
    padding: 10px 10px;
  }

  .chat-header {
    align-items: stretch;
    flex-direction: column;
  }

  .call-header {
    flex-direction: column;
    align-items: stretch;
  }

  .call-actions {
    justify-content: flex-start;
  }

  .search-box {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .message-list {
    padding: 10px;
  }

  .message {
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 8px 4px;
  }

  .message .avatar {
    width: 36px;
    height: 36px;
  }

  .message-actions {
    grid-column: 2;
    display: flex;
  }

  .composer {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px;
  }

  .send-button span:last-child {
    display: none;
  }

  .composer button[data-action="cancelEdit"] {
    grid-column: 1 / -1;
  }

  .compact-form,
  .search-hit,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .device-actions {
    grid-template-columns: 1fr;
  }

  .camera-test-shell {
    min-height: 120px;
  }

  .settings-modal {
    width: min(100%, calc(100vw - 20px));
  }

  .call-window-header {
    align-items: stretch;
    flex-direction: column;
    padding: 8px;
  }

  .call-window .voice-stage {
    max-height: 40dvh;
    overflow: auto;
  }

  .chat-pane.call-only .call-window .voice-stage {
    max-height: none;
  }

  .chat-pane.call-only .video-tile {
    min-height: clamp(190px, 36dvh, 380px);
  }

  .call-window .video-grid {
    grid-template-columns: minmax(180px, 1fr);
  }

  .video-tile.focused {
    min-height: 240px;
  }

  .chat-pane.call-only .video-grid {
    grid-template-columns: 1fr;
  }

  .call-stage {
    padding: 8px;
  }

  .call-stage .video-grid {
    grid-template-columns: 1fr;
  }

  .call-stage .video-tile {
    min-height: 170px;
  }
}
