@media (max-width: 799px) {
  html {
    --chat-side-space: max(12px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
    --chat-picker-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  }

  html:has(#app > :is(.auth, .chat-panel)),
  body:has(#app > :is(.auth, .chat-panel)) {
    overflow-x: clip;
  }

  .auth :is(input:not([type='checkbox']), select) {
    font-size: 16px;
  }

  #chat-conversation {
    background: transparent;
  }

  #chat-history {
    min-inline-size: 0;
    background: #bdcec6;
  }

  #chat-conversation #chat-messages {
    overflow-x: hidden;
    padding-inline: var(--chat-side-space);
  }

  #chat-conversation #chat-form {
    min-inline-size: 0;
    margin-inline: var(--chat-side-space);
    border: 0;
    border-radius: 24px !important;
    background: transparent;
    box-shadow: none;
  }

  #chat-conversation #chat-form:not(.editing) {
    padding-block: 3px;
  }

  #chat-conversation #chat-form:focus-within {
    outline: none;
  }

  #chat-conversation .chat-file-hint,
  #chat-attachment-preview:not(:empty),
  #chat-transfer {
    padding-inline: var(--chat-side-space);
  }

  dialog.chat-attachment-picker {
    inset: calc(var(--chat-screen-top, 0px) + var(--chat-screen-height, 100dvh) - var(--chat-picker-bottom))
      auto auto calc(var(--chat-screen-left, 0px) + var(--chat-screen-width, 100vw) / 2);
    inline-size: min(32rem, calc(var(--chat-screen-width, 100vw) - 2 * var(--chat-side-space)));
    max-block-size: calc(var(--chat-screen-height, 100dvh) - var(--chat-picker-bottom) - 8px);
    margin: 0;
    padding-block-end: 0;
    border-radius: 18px !important;
    transform: translate(-50%, -100%);
  }

  #chat-list .chat-thread-wrap.last-pinned {
    border-bottom: 0;
  }

  #chat-list .chat-thread-wrap:not(:last-child)::after,
  #chat-list:has(.chat-other-list > .chat-thread-wrap) .chat-fixed-list > .chat-thread-wrap:last-child::after {
    position: absolute;
    inset-inline: 76px 4px;
    inset-block-end: 0;
    block-size: 1px;
    background: rgb(78 92 87 / 15%);
    content: '';
    pointer-events: none;
  }

  .chat-direct-conversation #chat-room-title > :is(.chat-personal-name, .chat-last-visit) {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-direct-conversation .chat-last-visit {
    margin-block-start: 2px;
    color: #536e65;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.15;
  }
}
