.message-notification-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.header-right .identity {
  flex: 0 0 auto;
}

.message-volume-wrap {
  position: relative;
  display: inline-flex;
}

.message-volume-panel {
  position: absolute;
  z-index: 80;
  top: calc(100% + 9px);
  right: 0;
  width: 230px;
  padding: 0.8rem;
  border: 1px solid rgba(29, 53, 87, 0.16);
  border-radius: 12px;
  background: #fff;
  color: #1d3557;
  box-shadow: 0 16px 36px rgba(15, 34, 58, 0.2);
}

.message-volume-panel[hidden] {
  display: none;
}

.message-volume-panel label,
.message-volume-panel label span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.message-volume-panel label {
  flex-direction: column;
  align-items: stretch;
  font-size: 0.8rem;
}

.message-volume-panel input[type="range"] {
  width: 100%;
  accent-color: #2d7a5b;
}

.message-volume-panel .message-sound-type {
  margin-bottom: 0.75rem;
}

.message-volume-panel select {
  width: 100%;
  min-height: 38px;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(29, 53, 87, 0.22);
  border-radius: 8px;
  background: #fff;
  color: #1d3557;
  font: inherit;
  font-weight: 700;
}

.message-volume-panel small {
  display: block;
  margin-top: 0.35rem;
  color: #617086;
  font-size: 0.7rem;
  line-height: 1.35;
}

.message-notification-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  padding: 0.55rem 0.72rem;
  border: 1px solid rgba(29, 53, 87, 0.18);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.74);
  color: #1d3557;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.message-notification-button:hover {
  background: #fff;
  border-color: rgba(29, 53, 87, 0.35);
  transform: translateY(-1px);
}

.message-notification-button:focus-visible {
  outline: 3px solid rgba(45, 122, 91, 0.28);
  outline-offset: 2px;
}

.message-notification-button[data-active="true"] {
  border-color: #2d7a5b;
  background: #e8f6ef;
  color: #1f684d;
}

.message-notification-button[data-blocked="true"] {
  border-color: #d69e2e;
  background: #fff7df;
  color: #855a08;
}

.message-notification-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.message-admin-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-left: auto;
}

.chat-panel .panel-head {
  flex-wrap: wrap;
}

.message-clear-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0.42rem 0.65rem;
  border: 1px solid #d77676;
  border-radius: 9px;
  background: #fff7f7;
  color: #9f2f2f;
  cursor: pointer;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
}

.message-clear-button:hover:not(:disabled) {
  background: #ffe9e9;
}

.message-clear-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.message-clear-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

[data-message-delete-feedback] {
  max-width: 150px;
  color: #52705f;
  font-size: 0.68rem;
}

[data-message-delete-feedback][data-error="true"] {
  color: #a73333;
}

@media (max-width: 880px) {
  .message-notification-button {
    width: 40px;
    padding: 0.55rem;
  }

  .message-notification-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

@media (max-width: 1100px) {
  .header-right {
    gap: 0.5rem;
  }

  .header-right .identity > span:last-child {
    display: none;
  }
}

@media (max-width: 900px) {
  .header-right .private {
    display: none;
  }
}

@media (max-width: 650px) {
  .app-header {
    min-height: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
  }

  .app-header .brand {
    width: 100%;
  }

  .app-header .brand p {
    display: none;
  }

  .app-header .header-right {
    width: 100%;
    justify-content: space-between;
    gap: 0.35rem;
    flex-wrap: nowrap;
  }

  .app-header .header-right > * {
    flex-shrink: 0;
  }
}

@media (max-width: 560px) {
  .message-notification-controls {
    gap: 0.25rem;
  }

  .message-notification-button {
    width: 36px;
    min-height: 36px;
    padding: 0.45rem;
    border-radius: 9px;
  }

  .message-volume-panel {
    position: fixed;
    top: 78px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .message-admin-tools {
    width: 100%;
    justify-content: flex-end;
  }
}
