:root {
  color-scheme: dark;
  --bg: #0d1017;
  --panel: #151a23;
  --panel-2: #1b2230;
  --line: #2a3344;
  --text: #eef2f8;
  --muted: #95a0b5;
  --accent: #35c2a1;
  --accent-2: #f2b84b;
  --danger: #e85d75;
}

@property --accent-hue {
  syntax: "<number>";
  inherits: true;
  initial-value: 164;
}

:root.rgb-accent {
  --accent: hsl(var(--accent-hue) 86% 58%);
  animation: rgbAccentHue 12s linear infinite;
}

@keyframes rgbAccentHue {
  from {
    --accent-hue: 0;
  }

  to {
    --accent-hue: 360;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(300px, 420px);
  align-items: center;
  justify-content: center;
  gap: 56px;
  padding: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #061411;
  font-size: 44px;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 56px;
  line-height: 1;
}

.brand p {
  color: var(--muted);
  margin-top: 10px;
  max-width: 360px;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  display: grid;
  gap: 16px;
}

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

.tab,
.primary,
.danger,
.icon-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.tab {
  background: var(--panel-2);
  color: var(--muted);
  padding: 10px;
}

.tab.active {
  background: #263245;
  color: var(--text);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  background: #0f131b;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  outline: none;
}

textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
}

input[type="range"] {
  padding: 0;
  height: 28px;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: var(--panel-2);
}

input[type="range"]::-webkit-slider-thumb {
  margin-top: -6px;
}

.primary {
  background: var(--accent);
  color: #041512;
  font-weight: 800;
  padding: 12px 16px;
}

.secondary {
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 14px;
  font-weight: 800;
}

.secondary.active {
  background: #f0b35b;
  color: #1c1204;
}

.danger {
  background: var(--danger);
  color: white;
  padding: 10px 14px;
}

.error {
  color: var(--danger);
  min-height: 20px;
}

.error.success {
  color: var(--accent);
}

.app-view {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-columns: 310px 1fr;
  position: relative;
}

.mobile-menu-button,
.mobile-sidebar-close,
.mobile-sidebar-backdrop,
.call-collapse-button {
  display: none;
}

.sidebar {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.topbar,
.conversation-head {
  position: relative;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.topbar,
.peer-profile-head,
.message-avatar,
.user-avatar {
  cursor: pointer;
}

.topbar > *,
.conversation-head > * {
  position: relative;
  z-index: 1;
}

.topbar.has-banner,
.conversation-head.has-banner {
  background-image: linear-gradient(90deg, rgba(21, 26, 35, 0.94), rgba(21, 26, 35, 0.64)), var(--profile-banner);
  background-size: cover;
  background-position: center;
}

.topbar span,
.conversation-head span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

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

.current-profile {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.peer-profile-head {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.peer-avatar {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
}

.current-profile > div {
  min-width: 0;
}

.current-avatar {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

.search-wrap {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.user-list {
  overflow: auto;
}

.user-row {
  position: relative;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text);
  background: transparent;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
}

.user-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 1;
  width: 0;
  border-radius: 0 6px 6px 0;
  background: var(--user-color, var(--accent));
  box-shadow: 0 0 0 transparent;
  opacity: 0;
  transition: width 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
  pointer-events: none;
}

.user-row:hover::before,
.user-row.active::before {
  width: 4px;
  opacity: 1;
  box-shadow: 0 0 14px color-mix(in srgb, var(--user-color, var(--accent)) 65%, transparent);
}

.user-row > * {
  position: relative;
  z-index: 2;
}

.user-row.has-banner {
  min-height: 68px;
  background-color: var(--panel-2);
  isolation: isolate;
  transition: box-shadow 180ms ease, background-color 180ms ease;
}

.user-row.has-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(rgba(15, 19, 27, 0.94), rgba(15, 19, 27, 0.94)),
    var(--profile-banner);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.user-row.has-banner .user-main,
.user-row.has-banner .status-dot {
  z-index: 4;
}

.user-row.has-banner::before {
  z-index: 3;
}

.user-row.has-banner:hover,
.user-row.has-banner.active {
  box-shadow: none;
}

.user-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
}

.user-text {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 2px;
}

.user-name-line,
.user-status-line {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-status-line {
  color: var(--muted);
  font-size: 12px;
}

.user-status-line:empty {
  display: none;
}

.user-call-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  min-width: 0;
}

.user-call-badge {
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(123, 132, 150, 0.36);
  border-radius: 999px;
  padding: 2px 6px;
  color: #c9d0df;
  background: rgba(123, 132, 150, 0.14);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.user-call-badge.streaming {
  border-color: color-mix(in srgb, var(--user-color, var(--accent)) 46%, transparent);
  color: var(--text);
  background: color-mix(in srgb, var(--user-color, var(--accent)) 18%, transparent);
}

.user-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--avatar-color);
  background-size: cover;
  background-position: center;
  color: #07100e;
  font-size: 13px;
  font-weight: 900;
}

.user-avatar.has-image {
  color: transparent;
}

.image-choice-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.image-choice-tile {
  position: relative;
  width: 46px;
  height: 46px;
}

.image-choice-tile.banner-choice-tile {
  width: 92px;
}

.image-choice {
  width: 100%;
  height: 100%;
  display: block;
  padding: 0;
}

.image-choice-action {
  position: absolute;
  top: -7px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.14s ease, transform 0.14s ease, border-color 0.14s ease;
}

.image-choice-tile:hover .image-choice-action {
  opacity: 1;
  transform: translateY(0);
}

.image-choice-action.edit {
  left: -7px;
  color: var(--accent);
}

.image-choice-action.remove {
  right: -7px;
  color: var(--danger);
}

.image-choice-action:hover {
  border-color: currentColor;
}

.image-choice {
  width: 46px;
  height: 46px;
  border: 2px solid transparent;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  cursor: pointer;
}

.image-choice.banner-choice {
  width: 92px;
}

.image-choice.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(53, 194, 161, 0.18);
}

.image-choice-empty {
  color: var(--muted);
  font-size: 12px;
}

.image-editor-dialog {
  width: min(520px, 100%);
}

.image-editor-preview {
  width: 100%;
  aspect-ratio: 3 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #10141c;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  margin: 12px 0;
  cursor: grab;
  touch-action: none;
}

.image-editor-preview:active {
  cursor: grabbing;
}

.image-editor-preview.avatar-preview {
  width: min(260px, 100%);
  aspect-ratio: 1;
  margin-inline: auto;
}

.participant-row .participant-info {
  min-width: 0;
}

.profile-view-dialog {
  display: grid;
  gap: 12px;
}

.profile-view-banner {
  position: relative;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--panel-2), #10141c);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.profile-view-avatar {
  position: absolute;
  left: 18px;
  bottom: -28px;
  width: 82px;
  height: 82px;
  border: 4px solid var(--panel);
  border-radius: 16px;
  font-size: 34px;
}

.profile-view-dialog > strong {
  margin-top: 26px;
  font-size: 20px;
}

.profile-view-status {
  color: var(--accent);
  font-weight: 800;
}

.profile-view-bio {
  color: var(--text);
  white-space: pre-wrap;
}

.user-row.active,
.user-row:hover {
  background-color: var(--panel-2);
}

.user-row.central-user {
  color: var(--accent);
  font-weight: 800;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #5c6577;
}

.status-dot.online {
  background: var(--user-color, var(--accent));
}

.status-dot.in-call {
  width: 10px;
  height: 10px;
  background: #7b8496;
  box-shadow: 0 0 0 3px rgba(123, 132, 150, 0.16);
}

.status-dot.streaming {
  background: var(--user-color, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--user-color, var(--accent)) 24%, transparent);
}

.user-meta {
  max-width: 170px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  background: #0f131b;
}

.actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--text);
}

.icon-button.call-active {
  width: auto;
  min-width: 78px;
  padding: 0 12px;
  font-weight: 800;
}

.icon-button.danger {
  background: var(--danger);
  color: white;
}

.file-button input {
  display: none;
}

.media-strip {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 160px minmax(180px, 260px) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #090c12;
}

.media-strip.collapsed .video-frame,
.media-strip.collapsed #localVideo,
.media-strip.collapsed .call-participants {
  display: none;
}

.call-participants {
  min-height: 72px;
  max-height: 132px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 9px 10px;
  display: grid;
  align-content: start;
  gap: 4px;
}

.call-participants strong {
  font-size: 13px;
}

.call-participants span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.participant-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 72px;
  align-items: center;
  gap: 7px;
  border-radius: 6px;
  padding: 3px;
}

.participant-row.speaking,
.participant-row.streaming.selected-stream {
  background: rgba(53, 194, 161, 0.08);
}

.participant-row.streaming {
  cursor: pointer;
}

.participant-row.streaming:hover {
  background: rgba(255, 255, 255, 0.055);
}

.participant-row.streaming.selected-stream {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--participant-color, var(--accent)) 55%, transparent);
}

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

.participant-info {
  display: flex !important;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.participant-avatar {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--avatar-color, var(--accent));
  background-size: cover;
  background-position: center;
  color: #07110e;
  font-size: 12px;
  font-weight: 900;
}

.participant-avatar.has-image {
  color: transparent;
}

.participant-info span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #7b8496;
  box-shadow: 0 0 0 3px rgba(123, 132, 150, 0.12);
}

.participant-row.speaking .voice-dot,
.participant-row.streaming .voice-dot {
  background: var(--participant-color, var(--accent));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--participant-color, var(--accent)) 22%, transparent);
}

.participant-self-badge {
  border: 1px solid rgba(53, 194, 161, 0.35);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--accent) !important;
  font-weight: 800;
  white-space: nowrap;
}

.participant-row input[type="range"] {
  height: 24px;
  padding: 0;
}

.mini-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0f131b;
  color: var(--muted);
  padding: 4px 7px;
  cursor: pointer;
  font-size: 12px;
}

.mini-button.active {
  border-color: var(--danger);
  color: var(--danger);
}

.video-frame {
  position: relative;
  min-width: 0;
}

.stream-select {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  max-width: calc(100% - 56px);
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(9, 12, 18, 0.86);
  color: var(--text);
  padding: 0 8px;
  font-size: 13px;
  font-weight: 800;
}

video {
  width: 100%;
  max-height: 210px;
  background: black;
  border-radius: 8px;
}

.fullscreen-button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  display: none;
  place-items: center;
  background: rgba(9, 12, 18, 0.78);
  color: var(--text);
  cursor: pointer;
}

.fullscreen-button.visible,
.video-frame:hover .fullscreen-button {
  display: grid;
}

.video-frame:fullscreen {
  display: grid;
  place-items: center;
  background: black;
}

video:fullscreen,
.video-frame:fullscreen video {
  width: 100vw;
  height: 100vh;
  max-height: none;
  object-fit: contain;
  border-radius: 0;
}

.messages {
  min-height: 0;
  overflow: auto;
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message {
  width: 100%;
  padding: 8px 22px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  background: rgba(255, 255, 255, 0.018);
  border-left: 3px solid var(--sender-color);
  word-break: break-word;
}

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

.message.mine {
  background: rgba(53, 194, 161, 0.055);
}

.message.mine:hover {
  background: rgba(53, 194, 161, 0.095);
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--sender-color);
  color: #07100e;
  font-size: 15px;
  font-weight: 900;
  margin-top: 2px;
  background-size: cover;
  background-position: center;
}

.message-avatar.has-image {
  color: transparent;
}

.message-content {
  min-width: 0;
  position: relative;
  padding-right: 34px;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.message-header strong {
  color: var(--sender-color);
  font-size: 15px;
  font-weight: 800;
}

.message-header time {
  color: var(--muted);
  font-size: 12px;
}

.message-body {
  color: #d9dee9;
  white-space: pre-wrap;
  line-height: 1.45;
}

.message-body a {
  color: var(--accent);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.message-body a:hover {
  text-decoration: underline;
}

.message-image-caption {
  margin-bottom: 8px;
}

.message-image {
  display: block;
  width: auto;
  max-width: min(440px, 100%);
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  object-fit: contain;
  cursor: zoom-in;
}

.message-image-meta {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.message-audio {
  width: min(440px, 100%);
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.message-audio strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 13px;
}

.message-audio audio {
  width: 100%;
  height: 36px;
}

.message-upload-progress {
  width: min(440px, 100%);
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.message-upload-progress span {
  color: var(--text);
  font-weight: 800;
}

.message-upload-progress progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #0f131b;
}

.message-upload-progress progress::-webkit-progress-bar {
  background: #0f131b;
}

.message-upload-progress progress::-webkit-progress-value {
  background: var(--accent);
}

.message-upload-progress small {
  color: var(--muted);
}

.message-upload-progress.failed {
  border-left-color: var(--danger);
}

.message-upload-progress.failed progress::-webkit-progress-value {
  background: var(--danger);
}

.message-delete,
.message-menu-item {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  border-radius: 6px;
}

.message-delete {
  margin-top: 8px;
  border: 1px solid rgba(232, 93, 117, 0.45);
  color: var(--danger);
}

.message-menu-wrap {
  position: absolute;
  top: 2px;
  right: 4px;
  z-index: 4;
}

.message-menu-button {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
  font-size: 20px;
}

.message:hover .message-menu-button,
.message-menu.open + .message-menu-button,
.message-menu-button:hover {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.message-menu {
  position: absolute;
  top: 32px;
  right: 0;
  width: 132px;
  display: none;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}

.message-menu.open {
  display: grid;
  gap: 3px;
}

.message-menu-item:hover {
  background: var(--panel-2);
}

.message-menu-item.edit {
  color: var(--accent);
}

.message-menu-item.danger {
  color: var(--danger);
}

.message.file {
  box-shadow: inset 0 0 0 1px rgba(242, 184, 75, 0.24);
}

.message.local-notice {
  cursor: pointer;
  background: rgba(242, 184, 75, 0.08);
  border-left-color: var(--accent-2);
}

.message.local-notice:hover {
  background: rgba(242, 184, 75, 0.14);
}

.message.local-notice .message-avatar {
  background: var(--accent-2);
}

.message.local-notice .message-header strong {
  color: var(--accent-2);
}

.notice-hint {
  display: block;
  color: var(--muted);
  margin-top: 6px;
  font-size: 12px;
}

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

.composer input,
.composer .primary {
  height: 46px;
}

.image-message-button {
  width: 54px;
  height: 46px;
  font-size: 12px;
  font-weight: 800;
}

.image-message-button input {
  display: none;
}

.admin-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
}

.admin-dialog {
  width: min(620px, 100%);
  max-height: 86vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.admin-dialog header,
.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-dialog h3 {
  margin: 18px 0 8px;
}

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

.admin-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #0f131b;
}

.report-form {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

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

.report-row {
  align-items: stretch;
  flex-direction: column;
}

.report-row p {
  margin: 2px 0 0;
  color: #d9dee9;
  white-space: pre-wrap;
  line-height: 1.45;
}

.admin-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-empty {
  color: var(--muted);
}

.small {
  padding: 7px 10px;
}

.settings-dialog,
.sound-dialog,
.edit-message-dialog {
  width: min(520px, 100%);
}

.settings-dialog {
  width: min(780px, 100%);
  padding: 20px;
}

.settings-dialog > header {
  position: sticky;
  top: -20px;
  z-index: 2;
  margin: -20px -20px 0;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), rgba(21, 26, 35, 0.94));
}

.edit-message-dialog {
  display: grid;
  gap: 12px;
}

.edit-message-dialog textarea {
  min-height: 140px;
  resize: vertical;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 16px 0 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.sound-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}

.account-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}

.settings-dialog h3 {
  margin: 18px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--text);
}

.settings-dialog h3:first-of-type {
  border-top: 0;
  padding-top: 8px;
}

.settings-dialog label {
  min-width: 0;
}

.settings-dialog textarea {
  min-height: 96px;
  resize: vertical;
}

.account-form label:has(textarea),
.account-form .image-choice-grid,
.account-form button,
.account-form .error {
  grid-column: 1 / -1;
}

.check-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.check-row input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.settings-dialog input[type="color"] {
  min-height: 44px;
}

.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 40;
  width: min(360px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
}

.toast {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: rgba(21, 26, 35, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.toast strong,
.toast span {
  display: block;
}

.toast span {
  color: var(--muted);
  margin-top: 3px;
}

.toast-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.toast-close {
  width: 32px;
  height: 32px;
}

.file-progress {
  cursor: default;
}

.file-progress.done {
  cursor: pointer;
  border-left-color: var(--accent-2);
}

.file-progress progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #0f131b;
}

.file-progress progress::-webkit-progress-bar {
  background: #0f131b;
  border-radius: 999px;
}

.file-progress progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
}

.file-progress.done progress::-webkit-progress-value {
  background: var(--accent-2);
}

.file-progress-meta {
  font-size: 12px;
}


@media (max-width: 760px) {
  .auth-view {
    grid-template-columns: 1fr;
    gap: 26px;
    align-items: stretch;
  }

  h1 {
    font-size: 42px;
  }

  .app-view {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 35;
    width: min(86vw, 330px);
    max-width: 100%;
    transform: translateX(-104%);
    transition: transform 180ms ease;
    border-right: 0;
    border-bottom: 0;
    box-shadow: 18px 0 48px rgba(0, 0, 0, 0.42);
  }

  .app-view.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
    background: rgba(0, 0, 0, 0.54);
  }

  .mobile-menu-button {
    position: fixed;
    top: 14px;
    left: 12px;
    z-index: 25;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
  }

  .mobile-sidebar-close {
    display: grid;
  }

  .conversation {
    height: 100vh;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  .conversation-head {
    min-height: 70px;
    padding: 10px 10px 10px 64px;
    gap: 8px;
  }

  .peer-profile-head {
    min-width: 0;
  }

  .peer-profile-head h2 {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 18px;
  }

  .conversation-head .actions {
    gap: 6px;
  }

  .conversation-head .icon-button {
    width: 38px;
    height: 38px;
  }

  .media-strip {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px;
    align-items: stretch;
  }

  .call-collapse-button {
    display: block;
    grid-column: 1 / -1;
    height: 38px;
  }

  .media-strip .video-frame,
  .media-strip #localVideo,
  .media-strip .call-participants {
    grid-column: 1 / -1;
  }

  .media-strip #localVideo {
    max-height: 110px;
  }

  .media-strip video {
    max-height: 180px;
  }

  .media-strip.collapsed {
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
  }

  .media-strip.collapsed .call-collapse-button {
    grid-column: auto;
  }

  .media-strip.collapsed .secondary,
  .media-strip.collapsed .danger {
    min-width: 0;
    padding: 9px 10px;
    white-space: nowrap;
  }

  .messages {
    padding-top: 10px;
  }

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

  .message-image {
    max-width: 100%;
    max-height: 280px;
  }

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

  .image-message-button {
    width: 46px;
  }

  .composer .primary {
    padding: 10px 12px;
  }

  .sound-grid {
    grid-template-columns: 1fr;
  }

  .account-form {
    grid-template-columns: 1fr;
  }

  .settings-actions {
    justify-content: stretch;
  }

  .settings-actions button {
    flex: 1;
  }
}
