:root {
  color-scheme: light;
  --bg: #edf3f8;
  --panel: #ffffff;
  --panel-2: #f6f9fb;
  --text: #16202a;
  --muted: #667789;
  --line: #d9e3eb;
  --accent: #1379c5;
  --accent-2: #0f5f9c;
  --sent: #dff1ff;
  --received: #ffffff;
  --shadow: 0 12px 32px rgba(21, 39, 56, 0.12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101820;
  --panel: #18232d;
  --panel-2: #202d38;
  --text: #edf5fb;
  --muted: #9cadbb;
  --line: #2d3e4b;
  --accent: #42a5ee;
  --accent-2: #74bdf4;
  --sent: #123d5d;
  --received: #22313d;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  width: 100vw;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.booting-popout .login-screen {
  display: none !important;
}

.booting-popout body {
  background: var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 18%, transparent), transparent 34%),
    var(--bg);
}

.login-card {
  position: relative;
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.pwa-login-compact .login-screen {
  min-height: 100dvh;
  padding: 12px;
}

.pwa-login-compact .login-card {
  gap: 14px;
  width: min(410px, 100%);
  padding: 18px;
  box-shadow: none;
}

.login-close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

.login-close-button:hover {
  border-color: var(--accent);
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

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

.login-logo {
  width: 56px;
  height: 56px;
}

.login-brand-horizontal {
  display: grid;
  align-items: stretch;
  gap: 8px;
}

.login-wordmark-panel {
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.login-wordmark-panel img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 64px;
  object-fit: contain;
  object-position: left center;
}

.login-brand h1 {
  font-size: 22px;
}

.login-brand p,
.login-note {
  color: var(--muted);
  font-size: 13px;
}

.login-form,
.admin-form {
  display: grid;
  gap: 10px;
}

.login-form button[type="submit"] {
  position: relative;
  min-height: 38px;
}

.login-form button[type="submit"].is-loading {
  cursor: wait;
}

.login-form button[type="submit"].is-loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: ltech-spin 0.75s linear infinite;
}

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

.remember-login {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--muted);
  font-size: 13px;
}

.remember-login input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.language-field {
  display: grid;
  gap: 6px;
}

.language-select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0 9px;
}

.language-select.compact {
  height: 36px;
  min-width: 92px;
  grid-column: 1 / -1;
}

.app-shell {
  position: fixed;
  inset: 0;
  display: grid;
  --sidebar-width: 312px;
  grid-template-columns: minmax(260px, var(--sidebar-width)) 7px minmax(360px, 1fr) minmax(240px, 300px);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.app-shell.detail-collapsed {
  grid-template-columns: minmax(260px, var(--sidebar-width)) 7px minmax(360px, 1fr);
}

.app-shell.detail-collapsed .detail-pane {
  display: none;
}

.sidebar,
.detail-pane,
.chat-pane {
  min-width: 0;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: var(--panel);
  overflow: hidden;
}

.sidebar-resize-handle {
  position: relative;
  min-width: 7px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 76%, var(--bg));
  cursor: ew-resize;
  user-select: none;
  touch-action: none;
}

.sidebar-resize-handle::after {
  content: "";
  position: absolute;
  inset: 0 -5px;
}

.sidebar-resize-handle:hover,
.app-shell.is-resizing-sidebar .sidebar-resize-handle {
  background: color-mix(in srgb, var(--accent) 22%, var(--panel));
}

.app-shell.is-resizing-sidebar,
.app-shell.is-resizing-sidebar * {
  cursor: ew-resize !important;
  user-select: none;
}

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

.brand-wordmark {
  min-width: 0;
  flex: 1;
}

.brand-wordmark {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
  text-decoration: none;
  cursor: pointer;
}

.brand-wordmark:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.brand-wordmark img {
  display: block;
  width: min(100%, 230px);
  height: 40px;
  object-fit: contain;
  object-position: left center;
}

.brand-settings-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 16px;
  padding: 0;
}

.brand-settings-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.brand-action-stack {
  display: grid;
  flex: 0 0 24px;
  grid-template-rows: repeat(2, 22px);
  gap: 4px;
  height: 48px;
}

.brand-action-stack .brand-settings-button {
  width: 24px;
  height: 22px;
  font-size: 14px;
  line-height: 1;
}

.brand-settings-button > span,
.announcement-button > span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  line-height: 1;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 17px;
  letter-spacing: 0;
}

.brand-row p,
.chat-header p,
.detail-card p,
dd,
.profile-copy span {
  color: var(--muted);
  font-size: 13px;
}

.auth-panel,
.profile-panel,
.request-block,
.friend-list-block,
.chat-list-block,
.detail-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-panel {
  padding: 10px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.tab,
.ghost-button,
.icon-button,
.inline-field button,
.file-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
}

.tab {
  min-height: 34px;
}

.tab.is-active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.auth-form,
.search-label {
  display: grid;
  gap: 9px;
}

label {
  color: var(--muted);
  font-size: 12px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  outline: none;
}

input {
  height: 38px;
  padding: 0 10px;
}

textarea {
  min-height: 42px;
  max-height: 240px;
  resize: none;
  padding: 10px 12px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.primary {
  border: 0;
  border-radius: 6px;
  min-height: 38px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.primary:disabled,
.ghost-button:disabled {
  cursor: default;
  opacity: 0.48;
}

.primary:disabled {
  background: color-mix(in srgb, var(--muted) 45%, var(--panel));
  color: color-mix(in srgb, var(--text) 55%, var(--panel));
}

.profile-panel {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.announcement-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.announcement-button.has-unread {
  width: 32px;
  height: 32px;
  background: #d9363e;
  border-color: #d9363e;
  color: #fff;
  transform: scale(1.06);
}

.profile-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #32a852;
  color: white;
  font-weight: 800;
}

.profile-copy {
  display: grid;
  min-width: 0;
  cursor: pointer;
  border-radius: 6px;
}

.profile-copy:hover {
  color: var(--accent);
}

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.request-block,
.friend-list-block,
.chat-list-block {
  padding: 10px;
}

.chat-list-block {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 150px;
  overflow: hidden;
}

.friend-list-block.is-collapsed {
  padding: 7px 10px;
}

.chat-list-block.is-collapsed {
  flex: 0 0 auto;
  min-height: 0;
}

.friend-list-block.is-collapsed .section-toolbar {
  margin-bottom: 0;
}

.friend-list-block.is-collapsed .section-toggle {
  min-height: 20px;
}

.account-tools {
  display: grid;
}

.account-manage-button {
  min-height: 40px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--accent);
  font-weight: 800;
}

.section-title,
.section-toggle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

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

.section-toolbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.friend-search-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 6px;
  margin-bottom: 8px;
}

.friend-search-bar input {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
}

.friend-search-bar input:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 20%, transparent);
}

.section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.section-title-button {
  margin-bottom: 8px;
}

.section-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.14s ease;
}

.is-collapsed > .section-toolbar .section-chevron,
.is-collapsed > .section-toggle .section-chevron {
  transform: rotate(-45deg);
}

.section-add-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

.section-add-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.request-history-icon {
  display: block;
  width: 19px;
  height: 19px;
  overflow: visible;
  pointer-events: none;
}

.request-history-line,
.request-history-check {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.request-history-check.is-accent {
  stroke: #ef5b4d;
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 6px;
}

.inline-field button {
  font-size: 22px;
}

.request-list,
.friend-list,
.chat-list {
  display: grid;
  gap: 8px;
  align-content: start;
  grid-auto-rows: max-content;
}

.friend-list,
.chat-list {
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  overscroll-behavior: contain;
}

.friend-list {
  height: var(--friend-list-height, 170px);
  max-height: 48vh;
  min-height: 84px;
  gap: 6px;
}

.chat-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding-bottom: 8px;
}

.request-item,
.friend-item,
.chat-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  min-height: max-content;
}

.request-item,
.friend-item {
  overflow: hidden;
}

.request-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 8px;
}

.request-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.request-copy strong,
.request-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-actions {
  display: flex;
  gap: 6px;
}

.request-action {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  padding: 0;
}

.request-action.accept {
  border-color: color-mix(in srgb, #13a10e 42%, var(--line));
  color: #13a10e;
}

.request-action.decline {
  border-color: color-mix(in srgb, #d13438 42%, var(--line));
  color: #d13438;
}

.request-action:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}

.friend-item {
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  min-height: 38px;
}

.friend-item:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.friend-item .chat-avatar {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 11px;
}

.friend-item .chat-copy strong {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
}

.friend-item .chat-copy span {
  font-size: 10px;
  line-height: 1.15;
}

.list-resize-handle {
  height: 10px;
  margin: 5px -2px -3px;
  cursor: ns-resize;
  border-radius: 999px;
  position: relative;
}

.list-resize-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 3px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: translate(-50%, -50%);
}

.list-resize-handle:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.is-collapsed > .friend-list,
.is-collapsed > .chat-list,
.is-collapsed > .list-resize-handle {
  display: none;
}

.chat-item {
  position: relative;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 6px;
  padding: 6px 7px;
  min-height: 52px;
  overflow: visible;
}

.chat-item.is-active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.chat-item.is-unread .chat-copy strong {
  font-weight: 900;
}

.chat-main {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
  min-height: 38px;
}

.chat-menu-wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.chat-menu-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  opacity: 0;
}

.chat-item:hover .chat-menu-button,
.chat-menu-button:focus,
.chat-menu-wrap:focus-within .chat-menu-button {
  opacity: 1;
}

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

.chat-menu {
  position: fixed;
  z-index: 1000;
  display: grid;
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.chat-menu button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 0 10px;
  text-align: left;
}

.chat-menu button:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.chat-menu.is-self-chat-menu [data-chat-action="leave"],
.chat-menu.is-self-chat-menu [data-chat-action="delete"] {
  display: none;
}

.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.chat-unread-count {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border: 1px solid color-mix(in srgb, #ffffff 35%, transparent);
  border-radius: 999px;
  background: #2f9ee6;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 52, 86, 0.24);
}

.chat-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #e2b12d;
  color: #17202a;
  font-weight: 800;
}

.presence-badge,
.presence-dot {
  display: inline-block;
  border-radius: 50%;
  background: var(--muted);
}

.presence-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--panel);
}

.profile-avatar .presence-badge {
  right: -5px;
  bottom: -5px;
  width: 16px;
  height: 16px;
}

.presence-dot {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.status-online {
  background: #13a10e;
}

.status-busy {
  background: #d13438;
}

.status-away {
  background: #f2b600;
}

.status-offline {
  background: #8a8f98;
}

.status-menu {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 62px;
  z-index: 12;
  display: grid;
  padding: 6px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.status-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0 12px;
  text-align: left;
}

.status-menu button:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.status-reset {
  margin-top: 6px;
  border-top: 1px solid var(--line) !important;
  color: var(--muted) !important;
}

.chat-copy {
  min-width: 0;
}

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

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

.chat-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-height: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg) 72%, var(--panel));
}

.chat-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.chat-title-block {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-heading-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-peer-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #f2d57a;
  color: #5e4a00;
  font-size: 13px;
  font-weight: 800;
}

.call-view {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 28px;
}

.call-view.is-active-call {
  display: block;
  height: 100%;
  min-height: 0;
  padding: 0;
}

.call-tab-dock-host {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.call-launch-panel {
  display: grid;
  gap: 22px;
  width: min(620px, 100%);
  text-align: center;
}

.call-launch-panel h3 {
  margin: 0;
  font-size: 20px;
}

.call-launch-panel p,
.call-device-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.call-launch-actions {
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
}

.call-launch-button {
  display: grid;
  place-items: center;
  gap: 8px;
  width: 132px;
  min-height: 112px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--text);
  font-weight: 700;
}

.call-launch-button .call-launch-icon {
  font-size: 34px;
  line-height: 1;
  color: var(--accent);
}

.call-launch-button:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, var(--panel));
}

.call-launch-button.is-unavailable {
  border-color: var(--line);
  background: color-mix(in srgb, var(--muted) 12%, var(--panel));
  color: var(--muted);
}

.call-launch-button.is-unavailable .call-launch-icon {
  color: var(--muted);
}

.call-dock {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1500;
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto;
  width: min(680px, calc(100vw - 44px));
  height: min(480px, calc(100dvh - 44px));
  min-width: 340px;
  min-height: 280px;
  resize: both;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111820;
  color: white;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.42);
}

.call-dock.is-minimized {
  grid-template-rows: auto minmax(150px, 1fr) auto;
  width: 320px;
  min-width: 0;
  height: 260px;
  min-height: 0;
  resize: none;
}

.call-dock.is-minimized .call-dock-controls {
  gap: 8px;
  min-height: 48px;
  padding: 6px 10px;
}

.call-dock.is-minimized .call-control-button {
  width: 36px;
  height: 36px;
}

.call-dock.is-tab-expanded {
  position: relative;
  inset: auto;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  resize: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.call-dock.is-detached {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-width: 0;
  min-height: 0;
  resize: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.call-dock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: #18232d;
  cursor: move;
}

.call-dock.is-detached .call-dock-header {
  cursor: default;
}

.call-dock.is-tab-expanded .call-dock-header,
.call-dock.is-minimized .call-dock-header {
  cursor: move;
}

.call-dock-header > div {
  display: grid;
  min-width: 0;
}

.call-dock-header strong,
.call-dock-header span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-dock-header .call-dock-header-actions {
  display: flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.call-dock-header span {
  color: #aebdca;
  font-size: 12px;
}

.call-header-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.call-video-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  grid-auto-rows: minmax(150px, 1fr);
  gap: 6px;
  min-height: 0;
  padding: 6px;
  overflow: auto;
  background: #0c1218;
}

.call-video-tile {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 6px;
  background: #263542;
}

.call-video-tile video {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0c1218;
}

.call-video-tile.has-video video {
  display: block;
}

.call-video-tile.has-video .call-participant-placeholder {
  display: none;
}

.call-video-tile .call-participant-placeholder {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #e2b12d;
  color: #17202a;
  font-size: 22px;
  font-weight: 800;
}

.call-video-tile .call-participant-name {
  position: absolute;
  left: 8px;
  bottom: 7px;
  max-width: calc(100% - 16px);
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.58);
  color: white;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-video-tile.is-local {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  width: min(31%, 190px);
  height: min(36%, 135px);
  border: 2px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
}

.call-dock.is-group .call-video-tile.is-local {
  width: min(25%, 160px);
  height: min(30%, 120px);
}

.call-dock-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: #18232d;
}

.load-older-messages-button {
  align-self: center;
  min-height: 32px;
  margin: 8px auto 14px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.load-older-messages-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
}

.call-control-button,
.call-round-button {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: white;
}

.call-control-button {
  width: 42px;
  height: 42px;
  background: #324552;
}

.call-control-button.is-off {
  background: #67727b;
  text-decoration: line-through;
}

.call-end-button,
.call-decline-button {
  background: #d13438;
  transform: none;
}

.call-audio-resume-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: #2176ae;
  color: #fff;
  font-weight: 700;
}

.call-accept-button {
  background: #13a10e;
}

.incoming-call-modal {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(340px, 100%);
  padding: 24px;
  text-align: center;
}

.incoming-call-icon {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel));
  color: var(--accent);
  font-size: 32px;
}

.incoming-call-modal p {
  color: var(--muted);
}

.incoming-call-actions {
  display: flex;
  gap: 34px;
  margin-top: 8px;
}

.call-round-button {
  width: 50px;
  height: 50px;
  font-size: 22px;
}

@media (max-width: 720px) {
  .call-dock {
    inset: 0;
    right: auto;
    bottom: auto;
    z-index: 5000;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 100vw;
    height: 100dvh;
    min-width: 0;
    min-height: 0;
    resize: none;
    border: 0;
    border-radius: 0;
  }

  .call-dock-header {
    padding-top: max(9px, env(safe-area-inset-top));
  }

  #openCallWindowButton,
  #fullscreenCallButton {
    display: none;
  }

  .call-dock-controls {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  html.mobile-call-active,
  html.mobile-call-active body {
    overflow: hidden;
  }

  html.mobile-call-minimized,
  html.mobile-call-minimized body {
    overflow: auto;
  }

  .call-dock.is-minimized {
    position: fixed;
    inset: auto 10px calc(74px + env(safe-area-inset-bottom)) auto;
    z-index: 5000;
    grid-template-rows: auto minmax(118px, 1fr) auto;
    width: min(210px, calc(100vw - 20px));
    height: 224px;
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  }

  .call-dock.is-minimized .call-dock-header {
    min-height: 38px;
    padding: 5px 7px;
  }

  .call-dock.is-minimized #callDockStatus,
  .call-dock.is-minimized #openCallWindowButton,
  .call-dock.is-minimized #fullscreenCallButton,
  .call-dock.is-minimized #toggleCallCameraButton,
  .call-dock.is-minimized #switchCallCameraButton,
  .call-dock.is-minimized #resumeCallAudioButton {
    display: none;
  }

  .call-dock.is-minimized .call-video-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(112px, 1fr);
    padding: 4px;
  }

  .call-dock.is-minimized .call-video-tile.is-local {
    display: none;
  }

  .call-dock.is-minimized .call-dock-controls {
    min-height: 44px;
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
  }

  .call-dock.is-minimized .call-control-button {
    width: 34px;
    height: 34px;
  }

  .call-launch-panel {
    gap: 16px;
  }

  .call-launch-button {
    width: 118px;
    min-height: 96px;
  }
}

.chat-tabs {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: stretch;
  max-width: 100%;
  min-height: 40px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.chat-tabs::-webkit-scrollbar {
  display: none;
}

.chat-tab {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  flex: 0 0 auto;
  min-width: 48px;
  min-height: 40px;
  height: 40px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 9px;
  box-sizing: border-box;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transform: none;
}

.chat-tab:hover,
.chat-tab:active {
  transform: none;
}

.chat-tab > * {
  pointer-events: none;
}

.chat-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.chat-tab::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 3px;
  border-radius: 3px;
  background: transparent;
  pointer-events: none;
}

.chat-tab.is-active {
  color: var(--text);
  font-weight: 800;
}

.chat-tab.is-active::after {
  background: #42a5ee;
}

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

.chat-header h2 {
  font-size: 19px;
  letter-spacing: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-icon-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.mini-icon-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.mini-icon-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ghost-button {
  min-height: 36px;
  padding: 0 12px;
}

.ghost-button.danger {
  border-color: color-mix(in srgb, #d13438 58%, var(--line));
  color: #ff8a8a;
}

.ghost-button.compact {
  min-height: 30px;
  padding: 0 10px;
}

.content-area {
  display: grid;
  grid-template-columns: 1fr auto;
  min-height: 0;
  overflow: hidden;
}

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

.empty-state {
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
}

.message {
  display: grid;
  gap: 5px;
  max-width: min(680px, 78%);
  align-self: flex-start;
}

.message:not(.system):not(.pending) {
  cursor: context-menu;
}

.message.mine {
  align-self: flex-end;
}

.message.system {
  align-self: center;
  max-width: 70%;
}

.message.system .bubble {
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  color: var(--muted);
  font-size: 12px;
}

.message.pending {
  opacity: 0.78;
}

.bubble {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--received);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  word-break: break-word;
}

.message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.deleted-message {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-style: italic;
}

.deleted-undo-button {
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  text-decoration: underline;
  padding: 0;
}

.message-table-wrap {
  max-width: 100%;
  overflow: auto;
}

.message-table {
  border-collapse: collapse;
  min-width: 180px;
  max-width: 100%;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
}

.message-table td {
  min-width: 72px;
  max-width: 240px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  vertical-align: top;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mine .message-table {
  background: color-mix(in srgb, var(--sent) 72%, var(--panel));
}

.mine .bubble {
  background: var(--sent);
}

.reply-preview {
  display: grid;
  width: 100%;
  gap: 2px;
  margin-bottom: 7px;
  padding: 7px 9px;
  border: 0;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  color: var(--text);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.reply-preview:hover {
  background: color-mix(in srgb, var(--accent) 13%, var(--panel));
}

.reply-preview strong,
.reply-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-preview span {
  color: var(--muted);
}

.message.is-located .bubble {
  animation: locate-message 1.7s ease;
}

@keyframes locate-message {
  0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }
  18%, 72% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 62%, transparent), 0 6px 20px color-mix(in srgb, var(--accent) 22%, transparent); }
}

.message-menu {
  position: fixed;
  z-index: 1800;
  display: grid;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.message-menu button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 0 10px;
  text-align: left;
}

.message-menu button:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.meta {
  color: var(--muted);
  font-size: 11px;
}

.attachment-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.image-gallery {
  display: grid;
  gap: 4px;
  width: min(620px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
}

.image-gallery-1 {
  width: min(360px, 100%);
  grid-template-columns: minmax(0, 1fr);
}

.image-gallery-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  height: clamp(150px, 22vw, 220px);
}

.image-gallery-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  height: clamp(135px, 18vw, 190px);
}

.image-gallery-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  height: clamp(125px, 16vw, 185px);
}

.attachment {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 82%, var(--accent));
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}

.image-attachment {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--panel-2);
  color: var(--muted);
  text-align: left;
  cursor: zoom-in;
}

.image-attachment img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 240px;
  object-fit: contain;
  background: var(--panel);
}

.image-attachment.is-single img {
  height: auto;
  max-height: 240px;
}

.image-attachment-name {
  overflow: hidden;
  padding: 0 8px 8px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-attachment:hover {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.image-gallery-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(12, 20, 28, 0.62);
  color: white;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.composer {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 8px;
  align-items: end;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.composer-context {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 18px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.composer-context div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.composer-context strong,
.composer-context span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-context strong {
  font-size: 12px;
  color: var(--accent);
}

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

.composer-context button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
}

.composer.drag-over {
  box-shadow: inset 0 0 0 2px var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.file-button {
  display: grid;
  place-items: center;
  height: 42px;
  color: var(--text);
  font-size: 20px;
}

.file-button input {
  display: none;
}

.file-preview {
  min-height: 0;
  padding: 0 18px 12px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.file-preview.has-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
}

.pending-file {
  display: grid;
  grid-template-columns: 28px minmax(140px, 1fr) 28px;
  gap: 8px;
  align-items: center;
  max-width: min(360px, 100%);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
}

.attachment.pending-attachment {
  pointer-events: none;
  opacity: 0.75;
}

.pending-file.uploading {
  border-color: var(--accent);
}

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

.pending-file span {
  color: var(--muted);
}

.remove-file-button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.account-search-field {
  display: block;
  margin-bottom: 10px;
}

.detail-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow: auto;
}

.detail-pane-close {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: 0 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 18px;
}

.detail-pane-close:hover,
.detail-toggle-button[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.asset-view {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  background: var(--panel);
}

.file-toolbar {
  margin-bottom: 16px;
}

.file-table {
  display: grid;
  border-top: 1px solid var(--line);
}

.file-row {
  display: grid;
  grid-template-columns: 56px minmax(220px, 1fr) minmax(150px, 190px) minmax(120px, 170px);
  gap: 14px;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}

.file-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.shared-view {
  display: grid;
  gap: 14px;
}

.asset-view.drag-over .shared-view {
  outline: 2px dashed var(--accent);
  outline-offset: 8px;
}

.shared-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.shared-breadcrumbs,
.shared-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 2px 0;
  font-weight: 700;
}

.link-button.danger {
  color: #d13438;
}

.shared-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  position: relative;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.shared-upload-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
}

.shared-table {
  display: grid;
  border-top: 1px solid var(--line);
  overflow-x: auto;
}

.shared-row {
  display: grid;
  grid-template-columns: 32px minmax(220px, 1fr) minmax(145px, 180px) minmax(110px, 150px) 72px minmax(80px, 120px);
  gap: 12px;
  align-items: center;
  min-width: 790px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.shared-row.is-selected {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.shared-folder-row {
  position: relative;
}

.shared-folder-row.drop-target {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--accent) 16%, var(--panel));
}

.shared-select-cell {
  display: grid;
  width: 32px;
  height: 36px;
  place-items: center;
}

.shared-select-cell input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.shared-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.shared-name-button,
.shared-name-link,
.shared-name-static {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  text-align: left;
  text-decoration: none;
}

.shared-name-button {
  border: 0;
  background: transparent;
  padding: 0;
  font-weight: 800;
}

.shared-name-static {
  font-weight: 800;
}

.shared-name-button:hover,
.shared-name-link:hover {
  color: var(--accent);
}

.shared-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.shared-item-icon {
  flex: 0 0 auto;
  font-size: 16px;
}

.shared-trash-button {
  display: inline-grid;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  font-size: 17px;
}

.shared-destination-modal,
.shared-operation-modal {
  width: min(520px, 100%);
}

.shared-destination-modal .modal-header.compact {
  grid-template-columns: minmax(0, 1fr) auto;
}

.shared-destination-list {
  display: grid;
  max-height: min(430px, 55vh);
  padding: 8px 16px;
  overflow: auto;
}

.shared-destination-option {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.shared-destination-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.shared-destination-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-operation-body {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 92px;
  padding: 16px;
}

.shared-operation-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: shared-operation-spin 800ms linear infinite;
}

.shared-operation-detail {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.file-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  justify-self: center;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.photo-item {
  display: grid;
  gap: 7px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
}

.photo-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.asset-empty {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 320px;
  color: var(--muted);
  text-align: center;
}

.history-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 100%;
}

.history-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.history-text {
  min-height: 320px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-family: "Consolas", "Malgun Gothic", "Segoe UI", monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  overflow: auto;
}

.search-panel {
  width: min(410px, 42vw);
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow: auto;
}

.search-panel-header {
  display: grid;
  grid-template-columns: 1fr 36px;
  gap: 8px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.search-box {
  display: grid;
  grid-template-columns: 1fr 36px;
  gap: 6px;
  padding: 10px 12px;
}

.search-results {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.search-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 260px;
  color: var(--muted);
  text-align: center;
}

.search-illustration {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel));
  color: var(--accent);
  font-size: 54px;
}

.search-result {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}

.search-result span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.detail-card {
  padding: 12px;
}

dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 12px 0 0;
}

dt {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.admin-panel {
  display: grid;
  gap: 10px;
}

.employee-result {
  display: none;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font-size: 13px;
}

.employee-result.show {
  display: grid;
  gap: 4px;
}

.employee-title {
  margin-top: 8px;
}

.employee-list {
  display: grid;
  gap: 7px;
  max-height: min(420px, 58vh);
  overflow: auto;
}

.employee-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.employee-item strong,
.employee-item span {
  display: block;
}

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

.account-context-menu {
  position: fixed;
  z-index: 1800;
  display: grid;
  min-width: 170px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.account-context-menu button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 0 10px;
  text-align: left;
}

.account-context-menu button:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.role-pill {
  padding: 3px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.small-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.small-button.danger {
  border-color: color-mix(in srgb, #d64545 42%, var(--line));
  color: #d64545;
}

.status-pill {
  display: inline-block;
  width: fit-content;
  margin-top: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, #32a852 14%, var(--panel));
  color: #278343;
  font-size: 11px;
  font-weight: 800;
}

.status-pill.suspended {
  background: color-mix(in srgb, #d89a1d 16%, var(--panel));
  color: #a86f00;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 14, 20, 0.55);
  z-index: 20;
}

.modal-panel {
  width: min(880px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.invite-modal {
  width: min(520px, 100%);
}

.friend-add-modal {
  width: min(420px, 100%);
}

.friend-request-history-modal {
  width: min(480px, 100%);
  max-height: min(540px, calc(100vh - 48px));
}

.friend-request-history-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}

.friend-request-history-toolbar .small-button {
  min-height: 34px;
}

.friend-request-history-list {
  max-height: min(350px, calc(100vh - 190px));
  overflow-y: auto;
  padding: 6px 18px 14px;
}

.friend-request-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.friend-request-history-item:last-child {
  border-bottom: 0;
}

.friend-request-history-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.friend-request-history-copy strong,
.friend-request-history-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-request-history-copy strong {
  font-size: 14px;
}

.friend-request-history-copy small {
  color: var(--muted);
  font-size: 12px;
}

.friend-request-status {
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
}

.friend-request-status.is-pending {
  color: #8b6500;
  background: rgba(245, 183, 0, 0.14);
}

.friend-request-status.is-accepted {
  color: #16834b;
  background: rgba(35, 176, 94, 0.14);
}

.friend-request-status.is-declined {
  color: #b43a43;
  background: rgba(218, 61, 72, 0.12);
}

.friend-request-history-empty {
  padding: 32px 12px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 560px) {
  .friend-request-history-modal {
    width: min(440px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
  }

  .friend-request-history-toolbar,
  .friend-request-history-list {
    padding-right: 14px;
    padding-left: 14px;
  }
}

.friend-add-body {
  padding: 16px;
}

.confirm-modal {
  width: min(420px, 100%);
}

.modal-header.compact {
  grid-template-columns: 1fr;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px;
}

.browser-startup-guide {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.browser-startup-guide ol {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 22px;
  color: var(--text);
  line-height: 1.55;
}

.browser-startup-address-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.browser-startup-address-row code {
  min-width: 0;
  padding: 11px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--accent);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}

@media (max-width: 520px) {
  .browser-startup-address-row { grid-template-columns: 1fr; }
}

.delete-confirm-form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.partial-copy-form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.partial-copy-form .confirm-actions {
  padding: 4px 0 0;
}

.save-folder-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

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

.settings-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.settings-modal {
  width: min(520px, 100%);
  overflow: auto;
}

#closeSettingsModalButton {
  position: relative;
  z-index: 2;
  align-self: start;
  pointer-events: auto;
  touch-action: manipulation;
}

.account-permission-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 82%, var(--accent) 18%);
}

.account-permission-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.account-permission-copy strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.account-permission-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.account-permission-control {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  cursor: pointer;
}

.account-permission-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.account-permission-switch {
  position: relative;
  width: 38px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--input);
  transition: background 150ms ease, border-color 150ms ease;
}

.account-permission-switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  transition: transform 150ms ease, background 150ms ease;
}

.account-permission-control input:checked + .account-permission-switch {
  border-color: var(--accent);
  background: var(--accent);
}

.account-permission-control input:checked + .account-permission-switch::after {
  background: #fff;
  transform: translateX(16px);
}

.account-permission-control input:focus-visible + .account-permission-switch {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 2px;
}

.account-permission-setting.is-locked .account-permission-control {
  cursor: default;
  opacity: 0.78;
}

.account-permission-state {
  min-width: 76px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
}

.account-permission-setting.is-granted .account-permission-state {
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 560px) {
  .account-permission-setting {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .account-permission-control {
    justify-content: flex-start;
  }
}

.announcement-modal {
  width: min(900px, calc(100vw - 24px));
  height: min(860px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
}

.announcement-modal .modal-body {
  min-height: 0;
  overflow-y: auto;
}

.announcement-admin-editor {
  display: grid;
  gap: 10px;
  padding: 14px 16px 0;
}

.announcement-input {
  width: 100%;
  min-height: 260px;
  max-height: 420px;
  padding: 14px;
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: #fff !important;
  color: #121820 !important;
}

.announcement-input:empty::before {
  content: attr(data-placeholder);
  color: #7a8794;
  pointer-events: none;
}

.announcement-length-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

#announcementLengthCounter {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.announcement-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.announcement-toolbar button {
  min-width: 34px;
  height: 32px;
  padding: 0 9px;
}

.announcement-toolbar [data-announcement-align] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.announcement-align-icon {
  width: 17px;
  height: 16px;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.announcement-align-icon > span {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}

.announcement-align-icon > span:nth-child(1),
.announcement-align-icon > span:nth-child(3) {
  width: 16px;
}

.announcement-align-icon > span:nth-child(2) {
  width: 11px;
}

.announcement-align-icon > span:nth-child(4) {
  width: 13px;
}

.announcement-align-icon.is-left {
  align-items: flex-start;
}

.announcement-align-icon.is-center {
  align-items: center;
}

.announcement-align-icon.is-right {
  align-items: flex-end;
}

.announcement-color {
  position: relative;
  width: 32px;
  min-width: 32px !important;
  padding: 0 !important;
}

.announcement-color::after {
  content: "";
  display: block;
  width: 16px;
  height: 5px;
  margin: auto;
  border-radius: 2px;
  background: var(--announcement-color);
}

.announcement-color.black { --announcement-color: #121820; }
.announcement-color.red { --announcement-color: #c62828; }
.announcement-color.blue { --announcement-color: #1565c0; }
.announcement-color.yellow { --announcement-color: #f9a825; }
.announcement-color.green { --announcement-color: #2e7d32; }

.announcement-paper {
  min-height: 360px;
  max-height: min(64vh, 650px);
  margin: 8px 16px 16px;
  padding: 22px;
  overflow-y: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  border: 1px solid #d8dee5;
  border-radius: 6px;
  background: #fff !important;
  color: #121820 !important;
  line-height: 1.65;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  user-select: text;
}

.announcement-modal-actions,
.announcement-modal .confirm-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 16px 16px;
}

.announcement-actions {
  align-items: center;
  gap: 8px;
}

.announcement-action-button {
  width: auto;
  min-width: 88px;
  padding-inline: 18px;
}

#publishAnnouncementButton {
  min-width: 104px;
}

.modal-panel.announcement-cancel-confirm-panel {
  width: min(360px, calc(100vw - 32px));
  min-height: 164px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 28px 24px 24px;
  text-align: center;
}

.modal-panel.announcement-cancel-confirm-panel h2 {
  width: 100%;
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
  text-align: center;
}

.modal-panel.announcement-cancel-confirm-panel .confirm-actions {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.modal-panel.announcement-cancel-confirm-panel .confirm-actions button {
  min-width: 80px;
}

@media (max-width: 640px) {
  .announcement-modal {
    width: calc(100vw - 12px);
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
  }

  .announcement-input {
    min-height: 220px;
  }

  .announcement-paper {
    min-height: 250px;
    max-height: 62vh;
    margin: 6px 12px 12px;
    padding: 16px;
  }
}

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

.settings-row div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.settings-row strong {
  font-size: 14px;
}

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

.pwa-install-row #pwaInstallSettingStatus {
  overflow: visible;
  line-height: 1.45;
  text-overflow: clip;
  white-space: normal;
}

.desktop-settings-group {
  display: grid;
  gap: 12px;
}

.settings-checkbox-row {
  cursor: pointer;
  user-select: none;
}

.settings-checkbox {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.compact-info-modal {
  width: min(480px, calc(100vw - 32px));
}

.file-limit-details {
  margin: 0 18px 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-line;
}

.shared-upload-progress-modal {
  width: min(520px, calc(100vw - 32px));
}

.shared-upload-progress-body {
  display: grid;
  gap: 12px;
  padding: 2px 18px 6px;
}

.shared-upload-progress-summary,
.shared-upload-progress-bytes {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.shared-upload-progress-summary strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-upload-progress-track {
  overflow: hidden;
  height: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
}

.shared-upload-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 120ms linear;
}

.call-diagnostic-modal {
  width: min(680px, calc(100vw - 32px));
}

.call-diagnostic-body {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.diagnostic-preview-wrap {
  position: relative;
  overflow: hidden;
  min-height: 240px;
  max-height: 380px;
  aspect-ratio: 16 / 9;
  background: #080d12;
  border: 1px solid var(--border);
}

.diagnostic-preview-wrap video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.diagnostic-preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #b8c6d0;
}

.diagnostic-preview-wrap.has-video .diagnostic-preview-empty {
  display: none;
}

.diagnostic-meter {
  height: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.diagnostic-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: #43a8e9;
  transition: width 80ms linear;
}

.diagnostic-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--border);
  border: 1px solid var(--border);
}

.diagnostic-results > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
}

.diagnostic-results dt {
  color: var(--text-secondary);
}

.diagnostic-results dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
}

.chat-participant-handles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 6px;
}

.chat-participant-handle {
  color: inherit;
}

.add-participant-friend-button {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #d9363e;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.danger-outline-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #b84b4b;
  border-radius: 6px;
  background: transparent;
  color: #d64545;
  font-weight: 700;
}

.danger-outline-button:hover {
  background: color-mix(in srgb, #d64545 12%, transparent);
}

.settings-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.settings-language-select {
  width: min(190px, 100%);
}

.settings-row .settings-theme-options {
  display: flex;
  gap: 0;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.theme-setting-button {
  width: 42px;
  min-width: 42px;
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 19px;
  font-weight: 700;
}

.theme-setting-button.is-active {
  background: var(--accent);
  color: white;
}

#settingsModal[data-mode="password"] .settings-body > .settings-row,
#settingsModal[data-mode="password"] .settings-logout-row {
  display: none;
}

#settingsModal[data-mode="password"] .settings-password-form {
  margin: 0;
}

.temporary-password-result {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.temporary-password-result > span {
  color: var(--muted);
  font-size: 12px;
}

.edit-account-admin-section {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.edit-account-admin-section p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.edit-account-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edit-account-admin-section .temporary-password-result {
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
}

.temporary-password-value-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.temporary-password-value-row input {
  font-family: Consolas, "Courier New", monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}

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

.settings-password-heading {
  display: grid;
  gap: 3px;
}

.settings-password-heading strong {
  font-size: 14px;
}

.settings-password-heading span,
.settings-form-status {
  color: var(--muted);
  font-size: 12px;
}

.settings-password-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.settings-password-form input {
  width: 100%;
}

.settings-password-footer {
  display: flex;
  min-height: 38px;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.settings-password-footer button {
  flex: 0 0 auto;
}

.settings-form-status.is-error {
  color: #d64545;
}

.settings-form-status.is-success {
  color: #278343;
}

@media (max-width: 520px) {
  .settings-row {
    grid-template-columns: 1fr;
  }

  .settings-actions {
    flex-wrap: wrap;
  }

  .settings-language-select {
    width: 100%;
  }

  .settings-row .settings-theme-options {
    width: 100%;
  }

  .theme-setting-button {
    flex: 1;
  }

  .settings-password-footer {
    align-items: stretch;
    flex-direction: column;
  }
}

.read-receipt {
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
}

.delete-confirm-form .confirm-actions {
  padding: 4px 0 0;
}

.delete-target {
  padding: 10px;
  border: 1px solid color-mix(in srgb, #d64545 35%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, #d64545 9%, var(--panel));
  color: var(--text);
  font-size: 13px;
}

.danger-primary {
  background: #d64545;
}

.danger-primary:hover {
  background: #c43737;
}

.invite-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.invite-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.invite-item {
  display: grid;
  grid-template-columns: 20px 38px 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
}

.invite-item.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--panel));
  box-shadow: inset 3px 0 0 var(--accent);
}

.invite-item input {
  width: 16px;
  height: 16px;
}

.invite-item small {
  display: block;
  color: var(--muted);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.modal-header {
  display: grid;
  grid-template-columns: 1fr 36px;
  gap: 12px;
  align-items: start;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  font-size: 18px;
}

.modal-header p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.account-modal-grid {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: 16px;
  padding: 16px;
  overflow: auto;
  max-height: calc(100vh - 132px);
}

.account-list-panel {
  min-width: 0;
}

.toast {
  position: fixed;
  left: 50%;
  top: 72px;
  display: flex;
  gap: 14px;
  align-items: center;
  transform: translateX(-50%) translateY(-36px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 8px;
  background: #111820;
  color: white;
  box-shadow: var(--shadow);
  z-index: 2100;
  opacity: 0;
  transition: 0.2s ease;
}

.toast span {
  min-width: 0;
}

.toast button {
  border: 0;
  background: transparent;
  color: white;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr) 34px;
  background: rgba(12, 14, 18, 0.86);
  color: white;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.image-viewer-bar {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 0 14px;
  background: rgba(24, 24, 24, 0.92);
}

.image-viewer-bar strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-viewer-icon,
.image-viewer-nav {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: white;
  text-decoration: none;
}

.image-viewer-icon {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  font-size: 20px;
}

.image-viewer-icon:hover,
.image-viewer-nav:hover {
  background: rgba(255, 255, 255, 0.14);
}

.image-viewer-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  overflow: auto;
  padding: 28px 72px;
  scrollbar-gutter: stable;
}

.image-viewer-stage img {
  display: block;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: calc(100vw - 144px);
  max-height: calc(100dvh - 146px);
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: #111;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.38);
  object-fit: contain;
  transform-origin: center;
  transition: transform 0.12s ease;
}

.image-viewer-nav {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 74px;
  border-radius: 8px;
  font-size: 44px;
  transform: translateY(-50%);
}

.image-viewer-nav.prev {
  left: 18px;
}

.image-viewer-nav.next {
  right: 18px;
}

.image-viewer-counter {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  background: rgba(24, 24, 24, 0.72);
}

.is-hidden,
.mobile-only {
  display: none !important;
}

.popout-mode .login-screen {
  min-height: 100dvh;
  padding: 14px;
}

.popout-mode .app-shell {
  grid-template-columns: minmax(0, 1fr);
  width: 100vw;
  height: 100dvh;
}

.popout-mode .sidebar,
.popout-mode .sidebar-resize-handle,
.popout-mode .detail-pane,
.popout-mode .chat-tabs,
.popout-mode .chat-actions,
.popout-mode #backButton,
.popout-mode #renameChatButton {
  display: none !important;
}

.popout-mode #mobileBottomNav {
  display: none !important;
}

.popout-mode .app-shell,
.popout-mode .sidebar,
.popout-mode .chat-pane {
  --mobile-nav-height: 0px;
}

.mobile-hub-view,
.mobile-bottom-nav,
.mobile-chat-action,
.mobile-action-sheet {
  display: none;
}

@media (max-width: 720px) {
  .brand-settings-button {
    display: none;
  }

  .call-diagnostic-modal {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
  }

  .diagnostic-preview-wrap {
    min-height: 180px;
  }

  .diagnostic-results {
    grid-template-columns: 1fr;
  }
  body {
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
  }

  .app-shell {
    --mobile-nav-height: calc(66px + env(safe-area-inset-bottom));
    background: var(--panel);
  }

  .sidebar {
    gap: 10px;
    padding: 14px 12px var(--mobile-nav-height);
    background: var(--panel);
  }

  .brand-row {
    min-height: 48px;
    padding: 0 4px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-wordmark {
    height: 44px;
  }

  .brand-wordmark img {
    width: min(100%, 220px);
    height: 36px;
  }

  .brand-row h1 {
    font-size: 18px;
  }

  .sidebar .profile-panel,
  .sidebar .account-tools,
  .sidebar .request-block,
  .sidebar .friend-list-block,
  .sidebar .chat-list-block,
  .sidebar .mobile-hub-view {
    display: none;
  }

  .app-shell[data-mobile-section="chats"] .sidebar .chat-list-block,
  .app-shell[data-mobile-section="friends"] .sidebar .friend-list-block,
  .app-shell[data-mobile-section="settings"] .sidebar #mobileSettingsView,
  .app-shell[data-mobile-section="notifications"] .sidebar #mobileNotificationsView {
    display: flex;
  }

  .app-shell[data-mobile-section="friends"] .sidebar .request-block:not(.is-hidden) {
    display: block;
    flex: 0 0 auto;
    order: 0;
    max-height: min(34dvh, 300px);
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel-2);
  }

  .app-shell[data-mobile-section="friends"] .sidebar .friend-list-block {
    order: 1;
  }

  .request-item {
    min-height: 58px;
  }

  .request-action {
    width: 42px;
    height: 42px;
  }

  .app-shell[data-mobile-section="settings"] .brand-row,
  .app-shell[data-mobile-section="notifications"] .brand-row {
    display: none;
  }

  .friend-list-block,
  .chat-list-block {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .friend-list-block {
    flex-direction: column;
  }

  .friend-list,
  .chat-list {
    height: auto;
    max-height: none;
    gap: 6px;
    padding: 0 2px 14px;
  }

  .friend-item,
  .chat-item {
    min-height: 62px;
    padding: 8px 10px;
    border-width: 0 0 1px;
    border-radius: 0;
    background: transparent;
  }

  .app-shell:not(.chat-open) .chat-item.is-active {
    border-color: var(--line);
    box-shadow: none;
  }

  .friend-item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .friend-item .chat-avatar,
  .chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 14px;
  }

  .friend-item .chat-copy strong,
  .chat-copy strong {
    font-size: 15px;
  }

  .friend-item .chat-copy span,
  .chat-copy span {
    font-size: 12px;
  }

  .chat-main {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    min-height: 44px;
  }

  .chat-menu-wrap,
  .list-resize-handle,
  .section-chevron {
    display: none;
  }

  .section-toolbar,
  .section-title-button {
    min-height: 42px;
    margin: 0 2px 6px;
  }

  .section-toggle {
    color: var(--text);
    font-size: 20px;
    text-transform: none;
  }

  .section-add-button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
  }

  .friend-search-bar {
    margin: 0 2px 8px;
  }

  .friend-search-bar input {
    height: 40px;
    border-radius: 20px;
  }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 900;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: var(--mobile-nav-height);
    padding: 5px 4px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    backdrop-filter: blur(18px);
  }

  .mobile-bottom-nav button {
    position: relative;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    min-width: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
  }

  .mobile-bottom-nav button span {
    height: 25px;
    font-size: 22px;
    line-height: 25px;
  }

  .mobile-bottom-nav button b {
    font-size: 11px;
    font-weight: 700;
  }

  .mobile-bottom-nav button.is-active {
    color: var(--accent);
  }

  .mobile-bottom-nav i {
    position: absolute;
    top: 2px;
    left: calc(50% + 8px);
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border: 2px solid var(--panel);
    border-radius: 9px;
    background: #d13438;
    color: white;
    font-size: 9px;
    font-style: normal;
    line-height: 13px;
  }

  .app-shell.chat-open .mobile-bottom-nav {
    display: none;
  }

  .mobile-hub-view {
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
  }

  .mobile-page-header {
    display: flex;
    flex: 0 0 auto;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px 12px;
    border-bottom: 1px solid var(--line);
  }

  .mobile-page-header h2 {
    font-size: 24px;
  }

  .mobile-page-header p {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-header-text-button {
    border: 0;
    background: transparent;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
  }

  .mobile-settings-list,
  .mobile-notification-list {
    min-height: 0;
    overflow-y: auto;
    padding: 12px 4px 20px;
  }

  .mobile-setting-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 68px;
    width: 100%;
    padding: 10px 8px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    text-align: left;
  }

  .mobile-setting-row > span {
    display: grid;
    gap: 4px;
  }

  .mobile-setting-row strong {
    font-size: 15px;
  }

  .mobile-setting-row small {
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-setting-row select {
    width: 132px;
  }

  .mobile-setting-button b {
    color: var(--muted);
    font-size: 24px;
    font-weight: 400;
  }

  .mobile-setting-button.danger strong {
    color: #d13438;
  }

  .mobile-theme-options {
    display: flex;
    gap: 5px;
  }

  .mobile-theme-options button {
    width: 38px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel-2);
    color: var(--text);
    font-size: 19px;
    line-height: 1;
  }

  .mobile-theme-options button.is-active {
    border-color: var(--accent);
    color: var(--accent);
  }

  .mobile-notification-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    min-height: 66px;
    padding: 10px 6px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    text-align: left;
  }

  .mobile-notification-item.is-unread {
    background: color-mix(in srgb, var(--accent) 9%, transparent);
  }

  .mobile-notification-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
  }

  .mobile-notification-copy strong,
  .mobile-notification-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-notification-copy span,
  .mobile-notification-copy time {
    color: var(--muted);
    font-size: 12px;
  }

  .chat-header {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    min-height: 64px;
    padding: max(8px, env(safe-area-inset-top)) 8px 8px;
  }

  .chat-title-row {
    gap: 8px;
  }

  .chat-peer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
  }

  .chat-header .chat-tabs,
  .chat-header #renameChatButton,
  .chat-header #chatSubtitle,
  .chat-actions #inviteButton,
  .chat-actions #searchButton,
  .chat-actions #archiveButton,
  .chat-actions #detailPaneToggleButton {
    display: none !important;
  }

  .chat-actions {
    display: flex;
    gap: 3px;
  }

  .mobile-chat-action {
    display: grid;
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: var(--accent);
  }

  .mobile-chat-action:disabled {
    color: var(--muted);
    opacity: 0.45;
  }

  .messages,
  .asset-view {
    padding: 14px 12px;
  }

  .composer {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }

  .mobile-action-sheet {
    position: fixed;
    z-index: 2600;
    inset: 0;
  }

  .mobile-action-sheet:not(.is-hidden) {
    display: block;
  }

  .mobile-action-sheet-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    background: rgba(5, 12, 18, 0.52);
  }

  .mobile-action-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    gap: 6px;
    padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
    border-radius: 8px 8px 0 0;
    background: var(--panel);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.2);
  }

  .mobile-action-sheet-handle {
    justify-self: center;
    width: 38px;
    height: 4px;
    border-radius: 2px;
    background: var(--line);
  }

  .mobile-action-sheet-panel > strong {
    padding: 8px 10px 5px;
    font-size: 14px;
  }

  .mobile-action-sheet-actions {
    display: grid;
  }

  .mobile-action-sheet-actions button,
  .mobile-action-sheet-cancel {
    min-height: 48px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    padding: 0 12px;
    text-align: left;
  }

  .mobile-action-sheet-actions button.danger {
    color: #d13438;
  }

  .mobile-action-sheet-cancel {
    margin-top: 4px;
    border: 0;
    border-radius: 6px;
    background: var(--panel-2);
    text-align: center;
    font-weight: 700;
  }
}

.popout-mode .chat-pane {
  grid-column: 1;
  min-width: 0;
}

.popout-mode .chat-header {
  grid-template-columns: 1fr;
  min-height: 64px;
  padding: 12px 16px;
}

.popout-mode .chat-title-block {
  gap: 0;
}

.popout-mode .content-area {
  grid-template-columns: minmax(0, 1fr);
}

.popout-mode .search-panel {
  display: none !important;
}

.popout-mode .messages {
  padding: 16px;
}

.popout-mode .message {
  max-width: min(520px, 86%);
}

.popout-mode .composer {
  grid-template-columns: 42px minmax(0, 1fr) 64px;
  padding: 10px 12px;
}

.popout-mode .file-preview {
  padding: 0 12px 10px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: minmax(250px, var(--sidebar-width)) 7px minmax(320px, 1fr);
  }

  .detail-pane {
    display: none;
  }

  .detail-toggle-button {
    display: none;
  }
}

@media (max-width: 720px) {
  .image-viewer-stage {
    padding: 16px 42px;
  }

  .image-viewer-stage img {
    max-width: calc(100vw - 84px);
    max-height: calc(100dvh - 122px);
  }

  .image-viewer-nav.prev {
    left: 2px;
  }

  .image-viewer-nav.next {
    right: 2px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
    height: 100dvh;
  }

  .sidebar-resize-handle {
    display: none;
  }

  .sidebar,
  .chat-pane {
    height: 100dvh;
  }

  .chat-pane {
    display: none;
  }

  .app-shell.chat-open .sidebar {
    display: none;
  }

  .app-shell.chat-open .chat-pane {
    display: grid;
  }

  .mobile-only {
    display: grid !important;
  }

  .chat-header {
    grid-template-columns: 36px 1fr auto;
    padding: 12px;
  }

  .chat-header h2 {
    font-size: 16px;
  }

  .ghost-button {
    max-width: 92px;
    padding: 0 8px;
    font-size: 12px;
  }

  .message {
    max-width: 88%;
  }

  .composer {
    grid-template-columns: 42px 1fr 58px;
    padding: 10px;
  }

  .content-area {
    grid-template-columns: 1fr;
  }

  .search-panel {
    position: absolute;
    inset: 62px 0 0 auto;
    width: min(100vw, 390px);
    box-shadow: var(--shadow);
    z-index: 10;
  }

  .file-row {
    grid-template-columns: 42px minmax(150px, 1fr);
  }

  .file-row span:nth-child(3),
  .file-row span:nth-child(4) {
    display: none;
  }

  .modal-backdrop {
    padding: 10px;
  }

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

.popout-mode .app-shell {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
}

.popout-mode .chat-pane {
  display: grid !important;
  height: 100dvh;
}

.popout-mode .sidebar,
.popout-mode .sidebar-resize-handle,
.popout-mode .detail-pane,
.popout-mode #backButton {
  display: none !important;
}

@media (max-width: 720px) {
  .sidebar {
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .app-shell:not(.chat-open) .sidebar {
    display: flex;
  }

  .app-shell[data-mobile-section="chats"] .chat-list-block,
  .app-shell[data-mobile-section="friends"] .friend-list-block,
  .app-shell[data-mobile-section="settings"] #mobileSettingsView,
  .app-shell[data-mobile-section="notifications"] #mobileNotificationsView {
    display: flex;
  }

  .chat-list,
  .friend-list,
  .mobile-settings-list,
  .mobile-notification-list {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-notification-item {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
  }

  .mobile-chat-action {
    display: grid;
    flex: 0 0 34px;
  }

  .mobile-chat-action.is-hidden {
    display: none !important;
  }

  .chat-title-block,
  .chat-heading-line,
  .chat-heading-line h2 {
    min-width: 0;
  }

  .chat-heading-line h2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-header {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    min-height: calc(62px + env(safe-area-inset-top));
    padding: max(8px, env(safe-area-inset-top)) 8px 8px;
  }

  .content-area,
  .messages,
  .asset-view {
    min-height: 0;
  }

  .mobile-action-sheet-actions button,
  .mobile-action-sheet-cancel,
  .mobile-bottom-nav button,
  .mobile-setting-button {
    touch-action: manipulation;
    cursor: pointer;
  }
}
