/* Grundlegendes Reset und Body Styling */
* {
  font-family: Arial, Helvetica, sans-serif;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* overscroll-behavior-y: none; */
  word-wrap: break-word;

  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
:root {
  --header-height: 3.5rem;

  --anim-time-01: .2s;
  --anim-time-02: .1s;

  --border-radius-01: .2rem;
  --border-radius-02: .5rem;
  --border-radius-03: .7rem;

  --anim-type-01: ease;
  --backdrop-blur-01: blur(50px);

  --color-light-01: #ECE8ED;
  --color-light-02: #ECFEFF;
  --color-light-03: #ECFEFF;
  --color-light-hover: #5d585f;

  --color-dark-01: #333;
  --color-dark-02: #211f24;
  --color-dark-03: #333;
  
  --color-accent-01: #24707B;
  --color-accent-switch: #24707B;
  
  --color-background-01: #1A191D;
  --color-background-02: #131015d9;
  --color-background-03: #0f0e11a8;

  --color-message-other: #2a282d;
  --color-message-other-text: #ECE8ED;
  --color-border-subtle: #ffffff18;
  --color-link: #78b2ba;
  --color-on-accent-link: #e7f5f6;
  --icon-filter-message-other: none;

  --color-placeholder: #A9A9A9;
  
  --background-patern-url: url(/images/background-pattern.webp);
  --icon-filter-invert: none;
}

:root[data-theme="dark"] {
  --color-light-01: #ECE8ED;
  --color-light-02: #ECFEFF;
  --color-light-03: #ECFEFF;
  --color-light-hover: #5d585f;

  --color-dark-01: #333;
  --color-dark-02: #211f24;
  --color-dark-03: #333;
  
  --color-accent-01: #24707B;
  --color-accent-switch: #24707B;
  
  --color-background-01: #1A191D;
  --color-background-02: #131015d9;
  --color-background-03: #0f0e11a8;

  --color-message-other: #2a282d;
  --color-message-other-text: #ECE8ED;
  --color-border-subtle: #ffffff18;
  --color-link: #78b2ba;
  --color-on-accent-link: #e7f5f6;
  --icon-filter-message-other: none;

  --color-placeholder: #A9A9A9;
  
  --background-patern-url: url(/images/background-pattern.webp);
  --icon-filter-invert: none;
}

@media (prefers-color-scheme: light) {
  :root {
    --color-light-01: #333;
    --color-light-02: #cce3e4;
    --color-light-03: #ECFEFF;
    --color-light-hover: #b8c3c4;
    
    --color-dark-01: #333;
    --color-dark-02: #c8c6cc;
    --color-dark-03: #ECFEFF;
    
    --color-accent-01: #24707B;
    --color-accent-switch: #24707B;
    
    --color-background-01: #f4f1f4;
    --color-background-02: #e8e4e9e6;
    --color-background-03: #f4f1f4d9;

    --color-message-other: #e8e4e9;
    --color-message-other-text: #272429;
    --color-border-subtle: #1a191d1f;
    --color-link: #1d5c65;
    --color-on-accent-link: #f2fbfc;
    --icon-filter-message-other: invert(1);

    --color-placeholder: #6a6a6a;
    
    --background-patern-url: url(/images/background-pattern-light.webp);
    --icon-filter-invert: invert(1);
  }
}
:root[data-theme="light"] {
  --color-light-01: #333;
  --color-light-02: #cce3e4;
  --color-light-03: #ECFEFF;
  --color-light-hover: #b8c3c4;
  
  --color-dark-01: #333;
  --color-dark-02: #c8c6cc;
  --color-dark-03: #ECFEFF;
  
  --color-accent-01: #24707B;
  --color-accent-switch: #24707B;
  
  --color-background-01: #f4f1f4;
  --color-background-02: #e8e4e9e6;
  --color-background-03: #f4f1f4d9;

  --color-message-other: #e8e4e9;
  --color-message-other-text: #272429;
  --color-border-subtle: #1a191d1f;
  --color-link: #1d5c65;
  --color-on-accent-link: #f2fbfc;
  --icon-filter-message-other: invert(1);

  --color-placeholder: #6a6a6a;
  
  --background-patern-url: url(/images/background-pattern-light.webp);
  --icon-filter-invert: invert(1);
}

body {
  font-family: Arial, sans-serif;
  background: var(--color-background-01);
  /* background: #121215; */
}

input, label, h1, h2, h3, h4, h5, h6, p {
  color: var(--color-light-01);
}
.text-content {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}
*::selection {
  background-color: #24707Bcc;
  color: white;
}

#main-container {
  display: flex;
  height: 100dvh;
}

#chatList {
  flex: 0 0 min(30rem, 100vw);
  width: min(30rem, 100vw);
  height: 100dvh;
  z-index: 30;
  overflow: hidden;
  background-color: var(--color-background-02);

  transition: width var(--anim-time-01) var(--anim-type-01);
}
#chatList.closed {
  flex-basis: 0;
  width: 0;
  min-width: 0;
}
.camayo-brand {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  min-width: 16rem;
  padding: .75rem 4rem .75rem 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--color-light-01) 14%, transparent);
  cursor: pointer;
  transition: background-color var(--anim-time-01) var(--anim-type-01);
}
body:not(.touch) .camayo-brand:hover,
.camayo-brand:focus-visible {
  background-color: color-mix(in srgb, var(--color-light-01) 7%, transparent);
}
.camayo-brand img {
  flex: 0 0 auto;
  border-radius: .75rem;
}
.camayo-brand strong,
.camayo-brand span {
  display: block;
  color: var(--color-light-01);
}
.camayo-brand span {
  margin-top: .1rem;
  font-size: .75rem;
  opacity: .65;
}
.camayo-brand .camayo-identity {
  max-width: 20rem;
  margin-top: .25rem;
  overflow: hidden;
  color: var(--color-light-01);
  font-size: .78rem;
  font-weight: 650;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: .9;
}
.settings-security-warning {
  margin: .5rem 0;
  padding: .65rem;
  border: 1px solid color-mix(in srgb, #d89a38 55%, transparent);
  border-radius: .55rem;
  background: color-mix(in srgb, #d89a38 16%, transparent);
}
#chatList ul{
	margin: 1rem 0 0 0;
}
#chatList li{
	list-style: none;
	background: var(--color-accent-01);
}
#chatList a{
	display: inline-block;
	color: var(--color-light-01);
	text-decoration: none;
	padding: .5rem 1rem .5rem 1rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.database-sidebar {
  height: calc(100dvh - 4.6rem);
  min-width: 16rem;
  overflow-y: auto;
  padding: .8rem 1rem 2rem;
  scrollbar-gutter: stable;
}
.sidebar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .5rem;
}
.sidebar-toolbar-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.sidebar-toolbar h2,
.sidebar-section h2,
.sidebar-section h3 {
  color: var(--color-light-01);
}
.sidebar-toolbar h2 {
  font-size: 1rem;
}
.sidebar-section h2,
.sidebar-section h3 {
  margin: .9rem .45rem .25rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .68;
}
.sidebar-add-button,
.sidebar-conversation-button,
.sidebar-person-button {
  all: unset;
  box-sizing: border-box;
  color: var(--color-light-01);
  cursor: pointer;
}
.sidebar-add-button {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--color-light-01) 22%, transparent);
  border-radius: 50%;
  font-size: 1.35rem;
  line-height: 1;
}
.sidebar-add-button:hover,
.sidebar-add-button:focus-visible {
  background: color-mix(in srgb, var(--color-light-01) 10%, transparent);
}
.sidebar-archive-toggle {
  padding: .45rem .65rem;
  border: 1px solid color-mix(in srgb, var(--color-light-01) 22%, transparent);
  border-radius: 999px;
  color: var(--color-light-01);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: .72rem;
}
.sidebar-archive-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  width: calc(100% - .7rem);
  min-height: 2.35rem;
  margin: .85rem .35rem .2rem;
  font-size: .78rem;
}
.sidebar-archive-footer svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-archive-toggle[aria-pressed="true"] {
  color: var(--color-light-03);
  background: var(--color-accent-01);
}
.sidebar-status {
  margin: .35rem 0 .75rem;
  padding: .55rem .65rem;
  border-radius: .45rem;
  color: var(--color-light-01);
  background: color-mix(in srgb, var(--color-light-01) 8%, transparent);
  font-size: .78rem;
  line-height: 1.35;
}
.sidebar-status[hidden] {
  display: none;
}
.sidebar-status[data-state="error"] {
  color: #fff;
  background: #8a2634;
}
#chatList .sidebar-list {
  margin: .15rem 0 .7rem;
  padding: 0;
}
#chatList .sidebar-list li {
  list-style: none;
  background: transparent;
}
#chatList .sidebar-list li.sidebar-item-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .15rem;
}
.sidebar-item-actions {
  display: flex;
  align-items: center;
  gap: .1rem;
}
.sidebar-item-action {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border: 0;
  border-radius: 50%;
  color: var(--color-light-01);
  background: transparent;
  cursor: pointer;
  opacity: .55;
}
.sidebar-item-action svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.sidebar-item-action.is-leave:hover,
.sidebar-item-action.is-leave:focus-visible {
  color: #ffdbe0;
  background: #8a2634;
}
.sidebar-item-action:hover,
.sidebar-item-action:focus-visible {
  background: color-mix(in srgb, var(--color-light-01) 12%, transparent);
  opacity: 1;
}
.sidebar-conversation-button,
.sidebar-person-button {
  display: grid;
  grid-template-columns: 1.55rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .45rem;
  width: 100%;
  min-height: 2.25rem;
  padding: .35rem .55rem;
  border-radius: .5rem;
  transition: background-color var(--anim-time-02) var(--anim-type-01);
}
.sidebar-conversation-button:hover,
.sidebar-conversation-button:focus-visible,
.sidebar-person-button:hover,
.sidebar-person-button:focus-visible {
  background: color-mix(in srgb, var(--color-light-01) 10%, transparent);
}
.sidebar-conversation-button.is-active {
  color: var(--color-light-03);
  background: var(--color-accent-01);
}
.sidebar-conversation-button:disabled,
.sidebar-person-button:disabled {
  cursor: wait;
  opacity: .55;
}
.sidebar-item-icon {
  display: grid;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  font-size: .82rem;
  opacity: .75;
  border-radius: .45rem;
  object-fit: cover;
}
.sidebar-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-unread-badge {
  display: inline-grid;
  grid-column: 3;
  grid-row: 1 / span 2;
  min-width: 1.55rem;
  height: 1.55rem;
  margin-left: auto;
  padding: 0 .42rem;
  place-items: center;
  align-self: center;
  border: 2px solid color-mix(in srgb, #ff4968 72%, white);
  border-radius: 999px;
  color: #fff;
  background: #d7193f;
  box-shadow: 0 0 0 2px #160f14, 0 0 .7rem #ff315980;
  font-size: .74rem;
  font-weight: 850;
  line-height: 1;
}
.sidebar-conversation-button.has-unread .sidebar-item-label {
  color: #fff;
  font-weight: 750;
}
.sidebar-conversation-button.has-unread .sidebar-item-details {
  color: color-mix(in srgb, var(--color-light-01) 82%, transparent);
}
.sidebar-person-avatar {
  display: grid;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  border-radius: 50%;
  color: var(--color-light-03);
  background: var(--color-accent-01);
  font-size: .72rem;
  font-weight: 700;
}
.sidebar-people {
  margin-top: .75rem;
  padding-top: .25rem;
  border-top: 1px solid color-mix(in srgb, var(--color-light-01) 12%, transparent);
}
.sidebar-people-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-people-heading .sidebar-add-button {
  width: 1.7rem;
  height: 1.7rem;
  margin-right: .35rem;
  font-size: 1rem;
}
.sidebar-empty {
  margin: .35rem .55rem .8rem;
  color: var(--color-light-01);
  font-size: .78rem;
  line-height: 1.35;
  opacity: .65;
}
.new-chat-dialog {
  width: min(32rem, calc(100vw - 2rem));
}
.new-chat-tab-panel > label {
  display: block;
  margin-bottom: .35rem;
  color: var(--color-light-01);
  font-size: .82rem;
}
.new-chat-tab-panel > input[type="search"] {
  width: 100%;
  padding: .72rem .8rem;
  border: 1px solid color-mix(in srgb, var(--color-light-01) 22%, transparent);
  border-radius: .55rem;
  color: var(--color-light-01);
  background: var(--color-background-01);
  font: inherit;
}
.new-chat-person-list {
  max-height: min(24rem, 50dvh);
  margin-top: .75rem;
  padding: 0;
  overflow-y: auto;
}
.new-chat-person-list li { list-style: none; }
.new-chat-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .25rem;
  margin: .75rem 0 1rem;
  padding: .25rem;
  border-radius: .65rem;
  background: color-mix(in srgb, var(--color-light-01) 7%, transparent);
}
.new-chat-tabs button {
  padding: .55rem .75rem;
  border: 0;
  border-radius: .45rem;
  color: var(--color-light-01);
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.new-chat-tabs button[aria-selected="true"] {
  color: var(--color-background-01);
  background: var(--color-light-01);
  font-weight: 700;
}
.new-chat-tab-panel[hidden] { display: none; }
.new-chat-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2rem;
  margin-bottom: .45rem;
}
.new-chat-panel-heading h3 {
  margin: 0;
  color: var(--color-light-01);
  font-size: .9rem;
}
.new-chat-panel-heading .sidebar-add-button {
  width: 1.8rem;
  height: 1.8rem;
  font-size: 1.1rem;
}
.new-chat-conversation-list {
  max-height: min(24rem, 50dvh);
  margin: 0;
  padding: 0;
  overflow-y: auto;
}
.new-chat-conversation-list li { list-style: none; }
.new-chat-permission-hint {
  margin: .65rem 0 0;
  color: var(--color-light-01);
  font-size: .78rem;
  opacity: .68;
}
.group-conversation-options label[hidden] { display: none; }

#chatListIcon {
  all: unset;
  box-sizing: border-box;
  position: fixed;
  top: 0;
  left: .45rem;
  cursor: pointer;
  width: var(--header-height);
  height: var(--header-height);
  z-index: 200;

  background-image: url(/images/side-panel.svg);
  background-position: center center;
  background-size: 1.55rem auto;
  background-repeat: no-repeat;

  filter: var(--icon-filter-invert);
  transition: left var(--anim-time-01) var(--anim-type-01), opacity var(--anim-time-01) var(--anim-type-01), background-size var(--anim-time-01) var(--anim-type-01);
}
#chatListIcon.side-open {
  left: calc(min(30rem, 100vw) - var(--header-height) - .45rem);
}
body:not(.touch) #chatListIcon:hover {
  opacity: .6;
  background-size: 1.7rem auto;
}
#chatListIcon:active {
  background-size: 1.35rem auto !important;
}

#container {
  position: relative;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  background: var(--color-background-01);
  background-image: var(--background-patern-url);

  transition: width var(--anim-time-01) var(--anim-type-01);
}

#chatWrapper {
  position: relative;
  margin: auto;
  top: 0; left: 0;
  overflow-y: auto;
  scroll-behavior: auto;
  padding: 5px;
  height: 100dvh; width: 100%;
  max-width: 90rem;

  mask-image: linear-gradient(#000 calc(100% - 6rem), #00000000 100%);
  overscroll-behavior-y: auto;
}

#chat {
  padding: 4rem clamp(10px, 4vw, 40px) 6rem clamp(10px, 4vw, 40px);
}

.chat-empty-state {
  min-height: calc(100dvh - 10rem);
  display: grid;
  place-content: center;
  gap: .45rem;
  padding: 2rem;
  text-align: center;
}
.chat-empty-state h2 {
  color: var(--color-light-01);
  font-size: clamp(1.15rem, 3vw, 1.5rem);
}
#chat .chat-empty-state p {
  max-width: 30rem;
  margin: 0;
  color: var(--color-light-01);
  opacity: .68;
}

#chat p {
  margin-bottom: 8px;
  line-height: 1.4;
}

#chat .file-preview {
	max-width: 100%;
}
.bubble {
  position: relative;
  display: flex;
  flex-direction: column;
	max-inline-size: 60vw;
  min-width: 1rem;
  margin-top: 1rem;
	margin-bottom: none;
  inline-size: fit-content;
}

.bubble .text {
  --bubble-radius-top-left: 1rem;
  --bubble-radius-top-right: 1rem;
  --bubble-radius-bottom-right: 1rem;
  --bubble-radius-bottom-left: 1rem;
  position: relative;
  margin: 2px 0;
  inline-size: fit-content;
  text-align: start;
  max-inline-size: 100%;
  font-size: 14px;
  word-wrap: break-word;
  border-radius:
    var(--bubble-radius-top-left)
    var(--bubble-radius-top-right)
    var(--bubble-radius-bottom-right)
    var(--bubble-radius-bottom-left);
}
.bubble.me .text ~ .text {
  --bubble-radius-top-right: .5rem;
}
.bubble.me .text:has(~ .text) {
  --bubble-radius-bottom-right: .5rem;
}
.bubble.other .text ~ .text {
  --bubble-radius-top-left: .5rem;
}
.bubble.other .text:has(~ .text) {
  --bubble-radius-bottom-left: .5rem;
}
.bubble .text .text-content {
  padding: 0.4rem 0.8rem;
}

/* Image previews provide the intrinsic width of their message segment. Captions
   fill that width and wrap without making the bubble wider. */
.bubble .text.has-image-preview .attachment-caption {
  contain: inline-size;
}

.bubble .text:has(.reaction) {
  padding-bottom: .5rem;
  margin-bottom: 1.2rem;
}
/* .bubble .text:has(.attachment-frame) .text-content {
  display: none;
  padding: 0 0;
} */

.bubble.me .text {
  background: var(--bubble-background);
  color: var(--color-light-03);
}
.bubble.other .text {
  background: var(--bubble-background);
  color: var(--color-message-other-text);
}
.bubble.me {
  --bubble-background: var(--color-accent-01);
  align-items: end;
  text-align: right;
  margin-left: auto;
}
.bubble.other {
  --bubble-background: var(--color-message-other);
  text-align: left;
}

mark {
  background-color: yellow;
  color: black;
  padding: 0 2px;
  border-radius: 2px;
}

.bubble-tail {
  position: absolute;
  bottom: -.05rem;
  display: block;
  height: .8rem;
  aspect-ratio: 62 / 66;
  color: var(--bubble-background);
  pointer-events: none;
}
.bubble.me .bubble-tail {
  right: -.23rem;
}
.bubble.other .bubble-tail {
  left: -.23rem;
  transform: scaleX(-1);
}

.bubble .text.highlight {
  --bubble-background: #fafa66;
  transition: background-color .5s ease-out;
}

/* .bubble.me .metadata {
  margin-right: 5px;
}
.bubble.other .metadata {
  margin-left: 5px;
} */

.metadata {
  max-width: fit-content;
  margin-top: 2px;
  color: var(--color-light-01);
}
.bubble.me .metadata {
  padding-right: .7rem;
}
.bubble.other .metadata {
  padding-left: .7rem;
}
/* 
.bubble:has(.text:nth-last-child(2) .reaction) .metadata {
  margin-top: 18px;
} */

.bubble .name,
.message-time {
  font-size: 0.8em;
}
.message-time {
  display: block;
  padding: 0 .65rem .45rem;
  text-align: end;
  line-height: 1;
  opacity: .72;
}
.image-time {
  position: absolute;
  right: .65rem;
  bottom: .55rem;
  z-index: 2;
  padding: 0;
  color: #fff;
  opacity: 1;
  text-shadow:
    0 1px 2px #000,
    0 0 2px #000c,
    0 0 1px #fff8;
}
.text:not(:has(.text-content)) > .message-time,
.attachment-message-footer:not(:has(.text-content)) .message-time {
  padding-top: .45rem;
}
.bubble.temp {
  opacity: 0.7;
}

.bubble .text.failed {
  --bubble-background: #e46363;
}

.bubble .error-msg {
  color: #c0392b;
  font-size: 0.85em;
  margin-top: 0.5em;
}

.bubble .error-msg button {
  background: none;
  border: 1px solid #c0392b;
  padding: 2px 6px;
  font-size: 0.8em;
  cursor: pointer;
}
.text.failed {
  border-left: 2px solid #cd0000;
}
.bubble .text.success {
  --bubble-background: #7cf27c;
  border-left: 2px solid #00d535;
}

/* Button zum schnellen Runterscrollen */
#scrollBtn {
  position: absolute;
  top: -3.5rem; right: 0;
  border-radius: var(--border-radius-02);
  width: fit-content;
  color: var(--color-light-01);
  border: 1px solid var(--color-light-01);
  padding: 10px 15px 12px 35px;
  cursor: pointer;
  font-size: 14px;
  display: block;
  
  background: var(--color-background-01);
  transition: background-color var(--anim-time-01) var(--anim-type-01), border var(--anim-time-01) var(--anim-type-01);
}
#scrollBtn[hidden] {
  display: none !important;
}
#scrollBtn:hover {
  background: var(--color-dark-02);
  border: 1px solid #ecfeff92;
}
#scrollBtn::before {
  display: block;
  position: absolute;
  top: 0; left: 0;
  content: "";
  height: 100%; aspect-ratio: 1;

  background-image: url(/images/down-arrow.svg);
  background-position: center center;
  background-size: 30%;
  background-repeat: no-repeat;

  transition: background-size var(--anim-time-01) var(--anim-type-01), opacity var(--anim-time-01) var(--anim-type-01);
}
body:not(.touch) #scrollBtn:hover::before {
  background-size: 40%;
  opacity: .6;
}
#scrollBtn:active::before {
  background-size: 20% !important;
}

/* Formular Styling */
form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--color-background-03);
  padding: 12px;
  /* border: 1px solid #ddd; */
  backdrop-filter: var(--backdrop-blur-01);
  border-radius: 4px;
}

.message-input-area {
  position: relative;
  width: 100%;
  min-height: 36px;
}

form input[type="text"],
form textarea {
  width: 100%;
  border: 1px solid var(--color-light-01);
  border-radius: .4rem .2rem .2rem .4rem;
  padding: 8px 12px;
  font-size: 14px;
  background-color: transparent;
  color: var(--color-light-01);
	min-height: 36px;
  height: 36px;
	max-height: 150px;
  overflow-y: hidden;
  resize: none;
  font-size: 1rem;
  transition: background-color var(--anim-time-01) var(--anim-type-01);
}
form textarea::placeholder {
  color: var(--color-placeholder);
}

#sendBtn {
  all: unset;

  display: block;
  position: absolute;
  height: 24px; aspect-ratio: 1;
  right: 6px; top: 6px;
  cursor: pointer;

  background-image: url(/images/send.svg);
  background-position: center center;
  background-size: 80%;
  background-repeat: no-repeat;

  filter: var(--icon-filter-invert);
  transition: opacity var(--anim-time-01) var(--anim-type-01), background-size var(--anim-time-01) var(--anim-type-01);
}
body:not(.touch) #sendBtn:hover {
  opacity: .6;
  background-size: 100%;
}
#sendBtn:active {
  background-size: 30% !important;
}

form input[type="text"],
form textarea:focus {
  background-color: #78787843;
  outline: none;
}
/*
form textarea {
  resize: vertical;
  min-height: 60px;
}
*/

body:not(.touch) form button[type="submit"]:hover {
  background: color-mix(in srgb, var(--color-accent-01) 88%, white);
}

.send-form-wrapper {
  position: absolute;
  bottom: 1rem; left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
}
.send-form-wrapper[hidden] {
  display: none;
}

form#form {
  position: relative;
  width: 90%;
  max-width: 75rem;
  display: flex;
  flex-direction: row;
  gap: .7rem;
  padding: .5rem .5rem .3rem .5rem;
  border-radius: .9rem;
  /* background: #fff; */

  background: var(--color-background-03);
  backdrop-filter: var(--backdrop-blur-01);
}

/* Drop-Area für Dateien */
#fileDropArea {
  border: 1.5px dashed var(--color-light-03);
  padding: 13px;
  width: 45px;
  height: 36px;
  text-align: center;
  color: var(--color-light-01);
  border-radius: .2rem .4rem .4rem .2rem;
  cursor: pointer;

  background-image: url(/images/paper-clip.svg);
  background-position: center center;
  background-size: 40%;
  background-repeat: no-repeat;

  filter: var(--icon-filter-invert);
  transition: opacity var(--anim-time-01) var(--anim-type-01), background-size var(--anim-time-01) var(--anim-type-01);
}
body:not(.touch) #fileDropArea:hover {
  opacity: .6;
  background-size: 50%;
}
#fileDropArea:active {
  background-size: 30% !important;
}
#fileDropArea.dragover {
  background-color: #78787843;
  border-color: var(--color-accent-switch);
}

/* Angeheftete Dateien */
.attachment-frame {
  max-width: 100%;
  overflow: hidden;
  border-radius:
    var(--bubble-radius-top-left)
    var(--bubble-radius-top-right)
    var(--bubble-radius-bottom-right)
    var(--bubble-radius-bottom-left);
}

.attachment-frame > a {
  display: block;
}
.attachment-preview {
  position: relative;
  width: var(--preview-width, 320px);
  max-width: 100%;
  aspect-ratio: var(--preview-ratio, 4 / 3);
  overflow: hidden;
  background: color-mix(in srgb, currentColor 8%, transparent);
}
.attachment-preview::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(100deg, transparent 25%, #ffffff18 45%, transparent 65%);
  transform: translateX(-100%);
  animation: attachment-loading 1.4s ease-in-out infinite;
}
.attachment-preview.is-loaded::before {
  display: none;
}
.bubble .text.has-image-preview:has(.attachment-message-footer) .attachment-frame {
  border-radius:
    var(--bubble-radius-top-left)
    var(--bubble-radius-top-right)
    0 0;
}

.bubble .text.has-image-preview {
  background: transparent;
}
.attachment-message-footer {
  background: var(--bubble-background);
  border-radius:
    0 0
    var(--bubble-radius-bottom-right)
    var(--bubble-radius-bottom-left);
  overflow: hidden;
}
.attachment-message-footer .text-content {
  padding: .55rem .65rem .25rem;
}

.attachment-frame img,
.file-preview {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0;
}
@keyframes attachment-loading {
  to { transform: translateX(100%); }
}
.composer-popovers {
  position: absolute;
  left: .5rem;
  bottom: calc(100% + .35rem);
  z-index: 4;
  display: flex;
  max-width: min(32rem, calc(100% - 1rem));
  flex-direction: column;
  align-items: flex-start;
  gap: .3rem;
  pointer-events: none;
}
#attachedFiles {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  max-width: 100%;
  pointer-events: auto;
}
/* Highlight beim Drag über Drop-Zone oder Textarea */
.drop-area.dragover,
#text.dragover {
  border: 2px dashed var(--color-accent-01);
  background-color: color-mix(in srgb, var(--color-accent-01) 14%, transparent);
  transition: background-color var(--anim-time-01) var(--anim-type-01), border var(--anim-time-01) var(--anim-type-01);
}
#text{
	padding-right: 2rem;
	field-sizing: fixed;
	box-sizing: border-box;
	height: auto;
	min-height: calc(1.35em + 18px);
	max-height: min(15rem, 40dvh);
	resize: none;
	line-height: 1.35;
	overflow-y: hidden;
}

/* Stil für einzelne angehängte Dateien */
.attached-file {
  position: relative;
  width: min(17rem, calc(100vw - 3rem));
  min-width: 0;
  padding: .35rem 2rem .35rem .35rem;
  background: color-mix(in srgb, var(--color-background-01) 94%, white);
  border-radius: .65rem;
  font-size: .82rem;
  display: flex;
  align-items: center;
  gap: .55rem;
  border: 1px solid color-mix(in srgb, var(--color-light-01) 18%, transparent);
  color: var(--color-light-01);
  box-shadow: 0 .2rem .7rem #0004;
  overflow: hidden;
}
.attached-file-preview {
  flex: 0 0 3.25rem;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: .4rem;
  overflow: hidden;
  background: color-mix(in srgb, var(--color-light-01) 10%, transparent);
}
.attached-file-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.attached-file-preview.is-file {
  background-color: color-mix(in srgb, var(--color-light-01) 10%, transparent);
  background-image: url(/images/paper-clip.svg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 42%;
  filter: var(--icon-filter-invert);
}
.attached-file-details {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: .2rem;
}
.attached-file-name {
  overflow: hidden;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attached-file-meta {
  color: var(--color-placeholder);
  font-size: .72rem;
  line-height: 1;
}
.file-info {
  padding: .55rem .75rem;
  text-wrap: wrap;
}
.file-info.nopreview {
  max-inline-size: 100%;
}

.file-info a {
  text-decoration: none;
}

.file-info a::before {
  display: inline-block;
  content: "";
  margin: 0 .2rem 0 0;
  height: 14px; aspect-ratio: 1;
  background-image: url(/images/paper-clip.svg);
  background-position: center 100%;
  background-size: 80%;
  background-repeat: no-repeat;
}
.bubble.other .file-info a {
  color: var(--color-message-other-text);
}
.bubble.me .file-info a {
  color: var(--color-light-03);
}
.bubble.other .file-info a::before {
  filter: var(--icon-filter-message-other);
}

.attached-file button {
  position: absolute;
  top: .3rem;
  right: .3rem;
  background: transparent;
  border: none;
  width: 1.45rem;
  height: 1.45rem;
  padding: 0;
  border-radius: 50%;
  font-size: 1.15rem;
  color: var(--color-placeholder);
  cursor: pointer;
  line-height: 1;
}

.attached-file button:hover {
  color: #ff9ca8;
  background: #ffffff12;
}

.overlay[hidden] {
  display: none !important;
}
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;

  background: var(--color-background-03);
  backdrop-filter: var(--backdrop-blur-01);
}

.overlay-content {
  max-width: 90%;
  max-height: 90%;
  border-radius: var(--border-radius-01);
  padding: 0;
}

.overlay-content img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  background-color: var(--color-light-01);
  box-shadow: 0 0 15px #00000080;
  cursor: pointer;
  padding: 0;
}

.attached-file.uploading::after {
  position: absolute;
  right: .55rem;
  bottom: .45rem;
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid color-mix(in srgb, var(--color-light-01) 25%, transparent);
  border-top-color: var(--color-light-01);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

.upload-status {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: .3rem .55rem;
  border: 1px solid color-mix(in srgb, var(--color-light-01) 14%, transparent);
  border-radius: .45rem;
  color: var(--color-light-03);
  background: color-mix(in srgb, var(--color-background-01) 92%, transparent);
  box-shadow: 0 .2rem .7rem #0004;
  font-size: .73rem;
  line-height: 1.25;
  animation: upload-toast-in .16s ease-out;
  pointer-events: none;
}

.upload-status[data-state="error"] {
  color: #ff9ca8;
}

.upload-status[data-state="warning"] {
  color: #ffd08a;
}

.upload-status[data-state="success"] {
  color: #aee8bd;
}

@keyframes upload-toast-in {
  from { opacity: 0; transform: translateY(.25rem); }
  to { opacity: 1; transform: translateY(0); }
}

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

dialog {
  padding: 1.5em 2em;
  border: none;
  border-radius: 6px;
  box-shadow: 0 0 30px rgba(0,0,0,0.3);
  font-size: 1rem;
  max-width: 400px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.group-dialog {
  margin: auto;
  width: min(34rem, calc(100vw - 2rem));
  max-width: 34rem;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  color: var(--color-light-01);
  background: var(--color-background-01);
  border: 1px solid color-mix(in srgb, var(--color-light-01) 18%, transparent);
  border-radius: .9rem;
}
.group-dialog-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.group-dialog-heading h2 {
  color: var(--color-light-01);
  font-size: 1.25rem;
}
.group-dialog-heading p {
  margin-top: .25rem;
  line-height: 1.35;
  opacity: .68;
}
.dialog-close-button {
  all: unset;
  display: grid;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  color: var(--color-light-01);
  cursor: pointer;
  font-size: 1.4rem;
}
.dialog-close-button:hover,
.dialog-close-button:focus-visible {
  background: color-mix(in srgb, var(--color-light-01) 10%, transparent);
}
.group-title-field {
  display: block;
  margin-bottom: .35rem;
  font-size: .82rem;
  font-weight: 700;
}
.group-conversation-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .7rem;
}
.group-conversation-options label {
  display: grid;
  gap: .35rem;
  color: var(--color-light-01);
  font-size: .82rem;
}
.group-conversation-options select {
  min-width: 0;
  padding: .65rem;
  border: 1px solid color-mix(in srgb, var(--color-light-01) 22%, transparent);
  border-radius: .5rem;
  color: var(--color-light-01);
  background: var(--color-background-01);
}
.sidebar-conversation-button .sidebar-item-label {
  align-self: end;
}
.sidebar-item-details {
  grid-column: 2;
  overflow: hidden;
  color: color-mix(in srgb, var(--color-light-01) 62%, transparent);
  font-size: .64rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 540px) {
  .group-conversation-options { grid-template-columns: 1fr; }
}
#groupTitle {
  width: 100%;
  padding: .7rem .75rem;
  border: 1px solid color-mix(in srgb, var(--color-light-01) 24%, transparent);
  border-radius: .5rem;
  color: var(--color-light-01);
  background: color-mix(in srgb, var(--color-light-01) 7%, transparent);
  font: inherit;
  user-select: text;
}
#groupTitle:focus {
  outline: 2px solid var(--color-accent-01);
  outline-offset: 2px;
}
.group-members-fieldset {
  margin-top: 1rem;
  padding: .75rem;
  border: 1px solid color-mix(in srgb, var(--color-light-01) 18%, transparent);
  border-radius: .55rem;
}
.group-members-fieldset legend {
  padding: 0 .35rem;
  color: var(--color-light-01);
  font-size: .82rem;
  font-weight: 700;
}
.group-member-options {
  max-height: min(18rem, 42dvh);
  overflow-y: auto;
}
.group-member-option {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .5rem .35rem;
  border-radius: .4rem;
  color: var(--color-light-01);
  cursor: pointer;
}
.group-member-option:hover {
  background: color-mix(in srgb, var(--color-light-01) 8%, transparent);
}
.group-member-option input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-accent-01);
}
.group-dialog-status {
  margin-top: .85rem;
  padding: .55rem .65rem;
  border-radius: .45rem;
  color: #fff;
  background: #8a2634;
  font-size: .82rem;
}
.group-dialog-status[hidden] {
  display: none;
}
.group-dialog-status[data-state="info"] {
  color: var(--color-light-01);
  background: color-mix(in srgb, var(--color-accent-01) 28%, var(--color-background-01));
}
.group-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: .65rem;
  margin-top: 1.1rem;
}
.group-dialog-actions button {
  padding: .65rem .85rem;
  border: 0;
  border-radius: .5rem;
  color: var(--color-light-01);
  cursor: pointer;
  font: inherit;
}
.group-dialog-actions .secondary-button {
  background: color-mix(in srgb, var(--color-light-01) 10%, transparent);
}
.group-dialog-actions .primary-button {
  color: var(--color-light-03);
  background: var(--color-accent-01);
}
.group-dialog-actions .secondary-button:hover,
.group-dialog-actions .secondary-button:focus-visible,
.group-dialog-actions .primary-button:hover,
.group-dialog-actions .primary-button:focus-visible {
  filter: brightness(1.12);
}
.group-dialog-actions button:disabled {
  cursor: wait;
  opacity: .65;
}
.group-management-list {
  display: grid;
  gap: .5rem;
  max-height: min(22rem, 48dvh);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}
.group-avatar-form {
  gap: .55rem;
  margin-top: 1rem;
  padding: .75rem;
  border-radius: .55rem;
  background: color-mix(in srgb, var(--color-dark-01) 35%, transparent);
}
.group-avatar-label {
  color: var(--color-light-01);
  font-size: .82rem;
  font-weight: 700;
}
.file-upload-drop-area {
  all: unset;
  box-sizing: border-box;
  display: flex;
  width: 100%;
  min-height: 4.6rem;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  padding: .8rem 1rem;
  border: 1.5px dashed color-mix(in srgb, var(--color-light-01) 48%, transparent);
  border-radius: .55rem;
  color: var(--color-light-01);
  background: color-mix(in srgb, var(--color-light-01) 4%, transparent);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--anim-time-01) var(--anim-type-01), background-color var(--anim-time-01) var(--anim-type-01);
}
.file-upload-drop-area:hover,
.file-upload-drop-area:focus-visible,
.file-upload-drop-area.dragover {
  border-color: var(--color-accent-01);
  background: color-mix(in srgb, var(--color-accent-01) 12%, transparent);
}
.file-upload-drop-area:focus-visible {
  outline: 2px solid var(--color-accent-01);
  outline-offset: 2px;
}
.file-upload-drop-area > * { pointer-events: none; }
.file-upload-icon {
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  background: url(/images/paper-clip.svg) center / 70% no-repeat;
  filter: var(--icon-filter-invert);
}
.file-upload-copy {
  display: block;
  min-width: 0;
  line-height: 1.25;
}
.file-upload-copy strong { color: var(--color-accent-01); }
.file-upload-copy small {
  display: block;
  margin-top: .25rem;
  opacity: .62;
}
.desktop-drop-hint { display: none; }
@media (hover: hover) and (pointer: fine) {
  .desktop-drop-hint { display: inline; }
}
.group-avatar-selection {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: .55rem;
  color: var(--color-light-01);
  font-size: .78rem;
}
.group-avatar-selection[hidden] { display: none; }
.group-avatar-selection img {
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border-radius: .45rem;
  object-fit: cover;
  background: color-mix(in srgb, var(--color-light-01) 8%, transparent);
}
.group-avatar-selection span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-avatar-form .secondary-button {
  min-height: 2.25rem;
  border: 0;
  border-radius: .45rem;
  color: var(--color-light-03);
  background: var(--color-accent-01);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.group-avatar-form .secondary-button:disabled {
  cursor: default;
  opacity: .45;
}
.group-management-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .7rem;
  border: 1px solid color-mix(in srgb, var(--color-light-01) 14%, transparent);
  border-radius: .55rem;
  background: color-mix(in srgb, var(--color-light-01) 5%, transparent);
}
.group-management-identity {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: .2rem;
}
.group-management-identity strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-role-badge {
  width: fit-content;
  color: color-mix(in srgb, var(--color-light-01) 72%, transparent);
  font-size: .75rem;
}
.group-role-badge.is-admin,
.group-role-badge.is-owner {
  color: var(--color-accent-01);
  font-weight: 700;
}
.group-management-actions {
  display: flex;
  flex: 0 0 auto;
  gap: .4rem;
}
.group-management-actions button,
.group-member-add-form button {
  padding: .48rem .62rem;
  border: 0;
  border-radius: .45rem;
  color: var(--color-light-01);
  background: color-mix(in srgb, var(--color-light-01) 10%, transparent);
  cursor: pointer;
  font: inherit;
  font-size: .8rem;
}
.group-management-actions .danger-button {
  background: #8a2634;
}
.group-member-add-form {
  margin-top: 1rem;
}
.group-member-add-form > label {
  display: block;
  margin-bottom: .35rem;
  font-size: .82rem;
  font-weight: 700;
}
.group-member-add-form > div {
  display: flex;
  gap: .5rem;
}
.group-member-add-form select {
  min-width: 0;
  flex: 1;
  padding: .6rem;
  border: 1px solid color-mix(in srgb, var(--color-light-01) 24%, transparent);
  border-radius: .45rem;
  color: var(--color-light-01);
  background: var(--color-background-01);
  font: inherit;
}
.group-member-add-form .primary-button {
  color: var(--color-light-03);
  background: var(--color-accent-01);
}
.group-management-actions button:disabled,
.group-member-add-form button:disabled {
  cursor: wait;
  opacity: .6;
}
@media (max-width: 560px) {
  .group-management-member {
    align-items: stretch;
    flex-direction: column;
  }
  .group-management-actions button {
    flex: 1;
  }
}
.contact-invite-dialog label {
  display: block;
  margin: .8rem 0 .35rem;
  color: var(--color-light-01);
  font-size: .82rem;
  font-weight: 700;
}
.contact-invite-qr {
  width: min(18rem, 100%);
  margin: 0 auto;
  padding: .6rem;
  border-radius: .65rem;
  background: #fff;
}
.contact-invite-qr svg {
  display: block;
  width: 100%;
  height: auto;
}
#contactInviteUrl {
  box-sizing: border-box;
  width: 100%;
  padding: .65rem .7rem;
  border: 1px solid color-mix(in srgb, var(--color-light-01) 24%, transparent);
  border-radius: .5rem;
  color: var(--color-light-01);
  background: color-mix(in srgb, var(--color-light-01) 7%, transparent);
  font: inherit;
  user-select: text;
}
.contact-invite-dialog .group-dialog-status {
  color: var(--color-light-01);
  background: color-mix(in srgb, var(--color-light-01) 8%, transparent);
}

#aboutCamayoDialog {
  margin: auto;
  width: min(38rem, calc(100vw - 2rem));
  max-width: 38rem;
  max-height: min(46rem, calc(100dvh - 2rem));
  overflow-y: auto;
  color: var(--color-light-01);
  background: var(--color-background-01);
  border: 1px solid color-mix(in srgb, var(--color-light-01) 18%, transparent);
  border-radius: 1rem;
}
.about-camayo-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.about-camayo-heading img {
  border-radius: .85rem;
}
.about-camayo-heading p {
  margin-top: .15rem;
  font-size: .8rem;
  opacity: .65;
}
.about-camayo-heading h2,
.about-camayo-heading p,
.about-camayo-copy,
.about-camayo-copy * {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  -webkit-touch-callout: default;
}
.about-camayo-copy p {
  margin: 0 0 1rem;
  line-height: 1.5;
}
.about-camayo-copy h3 {
  margin: 1.25rem 0 .45rem;
  font-size: 1rem;
}
.about-camayo-copy a {
  color: color-mix(in srgb, var(--color-accent-01) 55%, white);
  text-decoration: underline;
}
.about-camayo-sources {
  font-size: .78rem;
  opacity: .8;
}
#aboutCamayoClose {
  display: block;
  margin: 1.25rem 0 0 auto;
  padding: .65rem 1rem;
  border: 0;
  border-radius: .5rem;
  color: var(--color-light-03);
  background: var(--color-accent-01);
  cursor: pointer;
}

#uploadDialog a {
  color: color-mix(in srgb, var(--color-accent-01) 62%, white);
  text-decoration: none;
  font-weight: bold;
}

/**NAV BAR**/

#nav-bar {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 0 .75rem;
  top: 0; left: 0;
  width: 100%; height: var(--header-height);
  text-align: center;
  z-index: 100;
  
  background: var(--color-background-03);
  border-bottom: 1px solid var(--color-border-subtle);
  -webkit-backdrop-filter: var(--backdrop-blur-01);
  backdrop-filter: var(--backdrop-blur-01);
  
  transition: padding var(--anim-time-01) var(--anim-type-01);
}
#nav-bar.closed-side {
  padding-left: calc(var(--header-height) + .65rem);
}

.chatNameWrapper {
  min-width: 0;
  width: 100%;
  overflow: hidden;
  mask-image: linear-gradient(90deg, #000, #000 calc(100% - 6rem), #00000000 100%);
}
.conversation-title-button {
  all: unset;
  box-sizing: border-box;
  display: flex;
  max-width: 100%;
  align-items: center;
  gap: .65rem;
  padding: .32rem .45rem;
  border-radius: .55rem;
  color: var(--color-light-01);
  cursor: pointer;
  text-align: left;
}
.conversation-title-button:not(:disabled):hover,
.conversation-title-button:not(:disabled):focus-visible {
  background: color-mix(in srgb, var(--color-light-01) 9%, transparent);
}
.conversation-title-button:disabled { cursor: default; }
.conversation-title-button > img {
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  border-radius: .55rem;
  object-fit: cover;
}
.conversation-title-button > span {
  display: grid;
  min-width: 0;
}
.conversation-title-button strong {
  overflow: hidden;
  font-size: 1rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-title-button small {
  overflow: hidden;
  color: color-mix(in srgb, var(--color-light-01) 62%, transparent);
  font-size: .67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-menu-wrapper { position: relative; }
.conversation-menu-button {
  all: unset;
  box-sizing: border-box;
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border-radius: 50%;
  color: var(--color-light-01);
  cursor: pointer;
  font-size: 1.65rem;
  line-height: 1;
}
.conversation-menu-button:hover,
.conversation-menu-button:focus-visible,
.conversation-menu-button[aria-expanded="true"] {
  background: color-mix(in srgb, var(--color-light-01) 10%, transparent);
}
.conversation-menu {
  position: absolute;
  top: calc(100% - .25rem);
  right: 0;
  z-index: 220;
  display: grid;
  width: max-content;
  min-width: 13rem;
  padding: .35rem;
  border: 1px solid var(--color-border-subtle);
  border-radius: .65rem;
  background: var(--color-background-01);
  box-shadow: 0 .8rem 2rem #0008;
}
.conversation-menu[hidden] { display: none; }
.conversation-menu button {
  padding: .68rem .75rem;
  border: 0;
  border-radius: .4rem;
  color: var(--color-light-01);
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.conversation-menu button:hover,
.conversation-menu button:focus-visible { background: color-mix(in srgb, var(--color-light-01) 10%, transparent); }
.conversation-menu button.danger { color: #ffb8c2; }
.chatName {
  color: var(--color-light-01);
  font-size: 1.05rem;
  line-height: 1.2;
  font-weight: 500;
  text-wrap: nowrap;
  text-align: start;
  /* background-color: linear-gradient(90deg #000, #000 calc(100% - 14rem), #00000000 calc(100% - 8rem)); */
}

.tool-bar {
  flex: 0 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: .25rem;
}
.settings-icon {
  all: unset;
  box-sizing: border-box;
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  transition: opacity var(--anim-time-01) var(--anim-type-01), rotate var(--anim-time-01) var(--anim-type-01), background-size var(--anim-time-01) var(--anim-type-01);

  background-image: url(/images/settings.svg);
  background-position: center center;
  background-size: 1.65rem;
  background-repeat: no-repeat;

  filter: var(--icon-filter-invert);
}
body:not(.touch) .settings-icon:hover {
  opacity: .6;
  background-size: 1.8rem;
}
.settings-icon:active {
  background-size: 1.45rem !important;
}
.settings-icon.open {
  rotate: -45deg;
}

.settings-pane {
  position: fixed;
  top: var(--header-height); right: -30rem;
  height: calc(100dvh - var(--header-height)); width: 100%;
  max-width: 30rem;
  display: grid;
  padding: 1.5rem 2rem 2rem 2rem;
  grid-template-columns: 1fr auto;
  grid-template-rows: none;
  grid-auto-rows: auto;
  overflow-y: auto;
  opacity: 0;
  gap: 1rem;
  z-index: 80;
  align-items: center;
  background: var(--color-background-03);
  -webkit-backdrop-filter: var(--backdrop-blur-01);
  backdrop-filter: var(--backdrop-blur-01);

  transition: right var(--anim-time-02) var(--anim-type-01), opacity var(--anim-time-02) var(--anim-type-01);
}
.settings-pane.open {
  right: 0;
  opacity: 1;
}

.settings-pane h3 {
  align-self: start;
  text-align: center;
  grid-column: span 2;
  margin-bottom: .5rem;
}
.settings-test-push {
  grid-column: 1 / -1;
  align-self: flex-start;
  width: 100%;
  margin: .25rem 0 0;
  padding: .45rem .7rem;
  border: 1px solid color-mix(in srgb, var(--color-light-01) 30%, transparent);
  border-radius: .45rem;
  color: var(--color-light-01);
  background: transparent;
  cursor: pointer;
}
.settings-test-push:disabled {
  cursor: default;
  opacity: .45;
}
.settings-push-status {
  grid-column: 1 / -1;
  min-height: 1.2em;
  margin: 0 0 .35rem;
  color: var(--color-light-01);
  font-size: .75rem;
  opacity: .78;
}

.settings-admin-link {
  grid-column: span 2;
  justify-self: stretch;
  min-height: 2.75rem;
  padding: .7rem .9rem;
  border: 2px solid var(--color-accent-01);
  border-radius: .55rem;
  color: var(--color-light-03);
  background: var(--color-accent-01);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  margin-top: .35rem;
  transition: background-color var(--anim-time-02) var(--anim-type-01), border-color var(--anim-time-02) var(--anim-type-01), filter var(--anim-time-02) var(--anim-type-01);
}
.settings-admin-link:hover,
.settings-admin-link:focus-visible {
  filter: brightness(1.12);
}
.settings-admin-link[hidden] {
  display: none;
}

.settings-security {
  --settings-action-color: color-mix(in srgb, var(--color-accent-01) 74%, var(--color-light-01));
  --settings-danger-color: color-mix(in srgb, #b42f46 78%, var(--color-light-01));
  grid-column: 1 / -1;
  display: grid;
  gap: .65rem;
  align-self: start;
  margin-top: .35rem;
  padding-top: 1rem;
  border-top: 1px solid color-mix(in srgb, var(--color-light-01) 16%, transparent);
}
.settings-security h4 {
  color: var(--color-light-01);
  font-size: .9rem;
}
.settings-security form {
  width: 100%;
  padding: 0;
  gap: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
}
.settings-security .settings-profile-form {
  display: grid;
  gap: .4rem;
}
.settings-profile-form > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .45rem;
}
.settings-profile-form input {
  min-width: 0;
  padding: .65rem .75rem;
  border: 1px solid color-mix(in srgb, var(--color-light-01) 24%, transparent);
  border-radius: .55rem;
  color: var(--color-light-01);
  background: color-mix(in srgb, var(--color-dark-01) 70%, transparent);
  font: inherit;
}
.settings-security .settings-profile-form button {
  width: auto;
}
.settings-profile-form p {
  min-height: 1.2em;
  font-size: .8rem;
}
.settings-security a,
.settings-security button {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: .65rem .85rem;
  border: 2px solid currentColor;
  border-radius: .55rem;
  color: var(--settings-action-color);
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--anim-time-02) var(--anim-type-01), color var(--anim-time-02) var(--anim-type-01), filter var(--anim-time-02) var(--anim-type-01);
}
.settings-security button.danger {
  color: var(--settings-danger-color);
  background: transparent;
}
.settings-security a:hover,
.settings-security a:focus-visible,
.settings-security button:hover,
.settings-security button:focus-visible {
  background: color-mix(in srgb, currentColor 10%, transparent);
  filter: none;
}
body:not(.touch) .settings-security button[type="submit"]:hover {
  background: color-mix(in srgb, currentColor 10%, transparent);
}


.settings-pane input[type=checkbox] {
  all: unset;
  display: block;
  position: relative;
  background-color: #ffffff77;
  width: 3rem; height: 1.5rem;
  border-radius: .75rem;
  box-shadow: 0 0 3px 0 #1f1f1f;
  cursor: pointer;
  transition: background-color var(--anim-time-02) ease-out;
}
.settings-pane input[type=checkbox]::after, #switchTheme::after {
  top: .2rem; left: calc(0% + .2rem);
  position: absolute;
  display: block;
  content: "";
  box-shadow: 0 0 3px 0 #1f1f1f;
  background-color: #536366;
  height: 1.1rem; aspect-ratio: 1;
  border-radius: .75rem;
  pointer-events: none;
  transition: left var(--anim-time-02) ease-out, background-color var(--anim-time-02) ease-out, scale var(--anim-time-02) ease-out;
}

.settings-pane input[type=checkbox]:checked, #switchTheme:has(#radio-dark:checked), #switchTheme:has(#radio-light:checked) {
  background-color: #ffffffc4;
}
body:not(.touch) .settings-pane input[type=checkbox]:hover::after, body:not(.touch) #switchTheme:hover::after {
  scale: 1.1;
}
.settings-pane input[type=checkbox]:active::after, #switchTheme:active::after {
  scale: .8 !important;
}

.settings-pane input[type=checkbox], .settings-pane input[type=radio] {
  justify-self: end;
}

#switchTheme {
  all: unset;
  position: relative;
  display: flex;
  background-color: #ffffff77;
  height: 1.5rem; width: 5rem;
  border-radius: .75rem;
  box-shadow: 0 0 3px 0 #1f1f1f;
  cursor: pointer;
  transition: background-color var(--anim-time-02) ease-out;
  margin: 1.1rem 0 1.25rem;
}
#switchTheme::after {
  top: .2rem; left: calc(50% - .55rem);
}

#switchTheme input[type=radio] {
  all: unset;
  height: 100%; width: 100%;
}

.settings-pane input[type=checkbox]:checked::after, #switchTheme:has(#radio-dark:checked)::after, #switchTheme:has(#radio-light:checked)::after {
  left: calc(100% - 1.1rem - .2rem);
  background-color: var(--color-accent-01);
}
#switchTheme:has(#radio-light:checked)::after {
  left: calc(0% + .2rem);
}

#switchTheme p {
  opacity: .3;
  position: absolute;
  width: 100%;
  left: 0; top: 1.9rem;
  font-size: .7rem;
  transition: opacity var(--anim-time-02) ease-out;
}
#switchTheme p:nth-child(5) {
  text-align: center;
  top: -1.1rem
} 
#switchTheme p:nth-child(6) {
  text-align: end;
} 
#switchTheme:has(#radio-light:checked) p:nth-child(4) {
  opacity: 1;
}
#switchTheme:has(#radio-auto:checked) p:nth-child(5) {
  opacity: 1;
}
#switchTheme:has(#radio-dark:checked) p:nth-child(6) {
  opacity: 1;
}


#chatSearchWrapper {
  width: 2.75rem;
  height: 2.75rem;
  position: relative;
  transition: width var(--anim-time-01) var(--anim-type-01), opacity var(--anim-time-01) var(--anim-type-01);
}
#chatSearchWrapper:focus-within {
  width: min(10rem, calc(100vw - 9rem));
}
#chatSearch {
  all: unset;
  display: block;
  box-sizing: border-box;
  width: 2.75rem;
  height: 2.25rem;
  margin-top: .25rem;
  padding: 0 .7rem;
  font-size: 1rem;
  text-align: start;
  border: 1px solid var(--color-light-01);
  color: transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: width var(--anim-time-01) var(--anim-type-01), border var(--anim-time-01) var(--anim-type-01), opacity var(--anim-time-01) var(--anim-type-01);
}
#chatSearch::placeholder {
  color: var(--color-placeholder);
  opacity: 0;
}
#chatSearch:focus {
  width: 100%;
  color: var(--color-light-01);
  padding-left: 2.2rem;
  cursor: text;
}
#chatSearch:focus::placeholder {
  opacity: 1;
}
body:not(.touch) #chatSearch:hover {
  border: 1px solid var(--color-light-hover);
}

.search-icon {
  position: absolute;
  top: .25rem;
  left: 0;
  width: 2.75rem;
  height: 2.25rem;
  transition: background-size var(--anim-time-01) var(--anim-type-01);

  background-image: url(/images/search.svg);
  background-position: center center;
  background-size: 1.25rem;
  background-repeat: no-repeat;
  pointer-events: none;

  filter: var(--icon-filter-invert);
}
body:not(.touch) #chatSearchWrapper:hover {
  opacity: .7;
}

#loadingMessages {
  color: var(--color-light-01);
}

/* context menu */
/* Reaktionen unter einer Nachricht */
.reactions {
  position: absolute;
  bottom: -1rem;
  width: max-content;
  display: flex;
  gap: 8px;
  margin-top: 4px;
  padding-left: 6px;
  z-index: 5;
  font-size: 0.85em;
}
.reaction {
  z-index: 50;
  border: 2.5px solid var(--color-background-01);
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--anim-time-01) var(--anim-type-01);
}

.bubble.other .reactions {
  left: .3rem;
}
.bubble.me .reactions {
  right: .3rem;
}

.bubble.other .reaction {
  background: var(--color-message-other);
  color: var(--color-message-other-text);
}
.bubble.me .reaction {
  background: var(--color-accent-01);
  color: var(--color-light-03);
}

.bubble.other .reaction:hover {
  background: #a6b1b2;
}
.bubble.me .reaction:hover {
  background: color-mix(in srgb, var(--color-accent-01) 78%, black);
}

.bubble .text-content.deleted {
  font-style: italic;
  opacity: .7;
  padding: .4rem .6rem;
}

.emoji-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  justify-content: flex-start;
}
.emoji-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.5rem;
  line-height: 1;
  font-size: 1.3em;
  cursor: pointer;
  transition: transform var(--anim-time-01) var(--anim-type-01);
}
.emoji-option:hover {
  transform: scale(1.3);
}


/* Touch-Fix: Unter iOS Safari usw. */
/* .bubble .text:active {
  background-color: rgba(255,255,255,0.05);
} */

/* Optionales Intro-Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* floating-menu.css oder in dein styles.css integrieren */

.floating-menu, .context-menu {
  position: absolute;
  border-radius: var(--border-radius-03);
  box-shadow: 0 4px 12px #00000026;
  padding: 8px 8px;
  z-index: 20;
  min-width: 140px;
  border: 1px solid var(--color-background-01);
  display: flex;
  flex-direction: column;

  background: var(--color-background-02);
  backdrop-filter: var(--backdrop-blur-01);
}
.floating-menu-item {
  opacity: .8;
}
.floating-menu-item, .context-item {
  padding: 8px 12px;
  font-size: 14px;
  color: var(--color-light-01);
  cursor: pointer;
  border-radius: .3rem;
  transition: background var(--anim-time-02) var(--anim-type-01);
}
.floating-menu-item:last-child {
  opacity: 1;
}
.floating-menu-item:hover, .context-item:hover {
  background: color-mix(in srgb, var(--color-accent-01) 14%, transparent);
}

#chat-dialog {
  position: fixed;
  flex-direction: column;
  padding: 0;
  width: clamp(10rem, 80%, 20rem);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--color-background-01);
  border-radius: var(--border-radius-02);
  overflow: hidden;
}

#dialog-title {
  padding: .7rem 1rem .5rem 1rem;
  font-weight: 100;
  text-align: center;
  font-size: 1rem;
  color: var(--color-accent-01);
}

#reply-to {
  position: relative;
  background-color: color-mix(in srgb, var(--color-accent-01) 38%, transparent);
  padding: .5rem 1rem;

}

#reply-to span {
  display: block;
  max-width: 100%;
  font-size: 14px;
  color: var(--color-light-01);
  text-align: start;
  mask-image: linear-gradient(90deg, #000 calc(100% - 2rem), #00000000);
  text-wrap: nowrap;
}

#dialog-text {
  padding: .7rem 1rem;
  width: 100%;
  margin: 0;
  font-size: 1rem;
  min-height: 3rem;
  max-height: 15rem;
  background-color: var(--color-background-01);
  border: 1px solid color-mix(in srgb, var(--color-accent-01) 58%, transparent);
  color: var(--color-light-01);

  resize: vertical;
}

#dialog-text:focus {
  background-color: color-mix(in srgb, var(--color-accent-01) 30%, transparent);
  outline: none;
}

.confirmation-wrapper {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background-color: var(--color-background-01);
}

.confirmation-wrapper input, .confirmation-wrapper button {
  all: unset;
  display: block;
  font-size: 1rem;
  padding: .5rem 1rem;
  pointer-events: all;
  color: var(--color-light-01);
  text-align: center;
  transition: background-color var(--anim-time-01) var(--anim-type-01);
}
.confirmation-wrapper input {
  background-color: color-mix(in srgb, var(--color-accent-01) 12%, transparent);
}
.confirmation-wrapper button {
  background-color: color-mix(in srgb, var(--color-accent-01) 38%, transparent);
}

.confirmation-wrapper input:hover, .confirmation-wrapper button:hover {
  background-color: var(--color-accent-01);
}
.confirmation-wrapper input:active, .confirmation-wrapper button:active {
  background-color: var(--color-background-01) !important;
}

.text-reply {
  border-radius: var(--border-radius-01) var(--border-radius-01) 0 0;
  padding: .4rem .5rem .4rem .5rem;
  background-color: color-mix(in srgb, var(--color-accent-01) 16%, transparent);
  color: var(--color-light-03);
  border-left: 4px solid color-mix(in srgb, var(--color-accent-01) 72%, transparent);
}
.reply-author {
  color: var(--color-link);
  display: block;
}
.bubble.me .text-reply {
  background-color: #ffffff24;
  border-left: 4px solid #ffffff80;
}
.bubble.me .reply-author {
  color: var(--color-on-accent-link);
}

/* Optional: kleine Optimierung auf Mobile */
@media (max-width: 600px) {
  .floating-menu {
    min-width: 120px;
  }
  .floating-menu-item {
    font-size: 16px;
  }
}

@media only screen and (max-width: 700px) {
  .settings-pane {
    padding: 1.25rem 1rem 2rem;
    column-gap: .75rem;
    row-gap: .9rem;
  }
  .settings-pane > label {
    line-height: 1.2;
  }
  #container {
    width: 0;
    overflow: hidden;
  }
  #container.closed-side {
    width: 100%;
  }
  #chatList {
    width: 100%;
  }
  #chatList.closed {
    width: 0;
  }
  #nav-bar {
    padding: 0 .75rem 0 calc(var(--header-height) + .65rem);
  }

}

@media (prefers-color-scheme: light) {
  .text-reply[data-theme="light"] {
    border-left: 4px solid var(--color-accent-01);
  }
  .reply-author[data-theme="light"] {
    color: var(--color-link);
  }
  .bubble.me .text-reply[data-theme="light"] {
    background-color: #ffffff30;
    border-left: 4px solid #ffffff80;
  }
  .bubble.me .reply-author[data-theme="light"] {
    color: var(--color-on-accent-link);
  }
}
@media (prefers-color-scheme: light) {
  .text-reply {
    border-left: 4px solid var(--color-accent-01);
  }
  .reply-author {
    color: var(--color-link);
  }
  .bubble.me .text-reply {
    background-color: #ffffff30;
    border-left: 4px solid #ffffff80;
  }
  .bubble.me .reply-author {
    color: var(--color-on-accent-link);
  }
}

/* needs styling or change place */

body.touch .bubble,
body.touch .bubble * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    /* …rest wie gehabt… */
  /* verhindert den iOS-Kontext bei Longpress */
  -webkit-touch-callout: none;
  /* erleichtert Touch-Interaktionen */
  touch-action: manipulation;
}

/* Ausnahmen, falls du doch mal Texte auswählbar machen willst:
   zum Beispiel in Formularfeldern oder an anderen Stellen */
body.touch textarea,
body.touch input {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
  touch-action: auto;
}

body.touch .text:active {
  filter: brightness(.5);
}

.link-preview {
  display: flex;
  border: 1px solid color-mix(in srgb, var(--color-accent-01) 38%, var(--color-border-subtle));
  background-color: color-mix(in srgb, var(--color-message-other) 88%, var(--color-accent-01));
  color: var(--color-message-other-text);
  border-radius: 4px;
  margin: 4px 0 3px;
  overflow: hidden;
  font-size: 0.9em;
}
.bubble.me .link-preview {
  background-color: color-mix(in srgb, var(--color-accent-01) 82%, black);
}

.link-preview.loading {
  height: 50px; /* Platz für Spinner o.ä. */
  background: #f9f9f9 url('/images/spinner.gif') center center no-repeat;
}
.preview-image img {
  width: 120px;
  height: 100%;
  object-fit: cover;
}

.preview-meta {
  padding: 8px 8px 3px 8px;
  flex: 1;
  color: var(--color-message-other-text);
}
.preview-meta h4 {
  margin: 0 0 4px;
  font-size: 1em;
}
.preview-meta p {
  margin: 0;
}

.preview-meta h4, .preview-meta p {
  color: var(--color-message-other-text);
}

.bubble.me .link-preview .preview-meta h4, .bubble.me .link-preview .preview-meta p {
  color: var(--color-light-03);
}

.text-content a {
  color: var(--color-link);
}
.text-content a:visited {
  color: var(--color-link);
}

.bubble.me .text-content a {
  color: var(--color-on-accent-link);
}
.bubble.me .text-content a:visited {
  color: var(--color-on-accent-link);
}

.text-reply a {
  color: var(--color-light-01);
}
.e2ee-device-notice {
  position: fixed;
  z-index: 10000;
  top: calc(var(--header-height) + .65rem);
  right: .75rem;
  width: min(22rem, calc(100vw - 1.5rem));
  padding: .55rem .75rem;
  border-radius: .65rem;
  background: #fff3cd;
  color: #4d3b00;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .18);
  pointer-events: none;
  text-align: left;
  font-size: .78rem;
  line-height: 1.3;
  font-weight: 600;
}

.e2ee-device-notice[data-state="error"] {
  background: #f8d7da;
  color: #721c24;
}
