/* Web slide-out menu, drawer header, user menu and utility actions. */

.menu-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid #e2ebf3;
  background:
    radial-gradient(circle at top right, rgba(34, 158, 217, 0.16), rgba(34, 158, 217, 0) 52%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 254, 0.98));
}

.menu-panel-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
}

.menu-panel-logo,
.menu-panel-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  flex: 0 0 auto;
}

.menu-panel-logo {
  object-fit: contain;
  object-position: center;
  background: #fff;
  border: 1px solid #d8e8f3;
}

.menu-panel-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ffffff, #e8f3fb);
  border: 1px solid #d8e8f3;
  font-size: 22px;
}

.menu-panel-copy {
  min-width: 0;
}

.menu-panel-copy h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
}

.menu-panel-copy p {
  margin: 4px 0 0;
  color: #607387;
  font-size: 13px;
  line-height: 1.35;
}

.drawer-close-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  font: inherit;
  cursor: pointer;
  border: 1px solid #d5e4ef;
  border-radius: 12px;
  background: #fff;
  color: #4b6579;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(29, 70, 98, 0.08);
  transition:
    background 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

.drawer-close-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.drawer-close-btn:hover {
  background: #f6fbff;
  color: #1a6f9e;
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(29, 70, 98, 0.12);
}

.menu-panel-body {
  overflow-y: auto;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.menu-user-chip,
.menu-section {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid #dce8f2;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 249, 253, 0.98)),
    #fff;
  box-shadow: 0 10px 26px rgba(27, 54, 76, 0.06);
}

.menu-user-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #698096;
}

.menu-user-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.menu-user-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.menu-user-chip strong,
.menu-section-note strong {
  font-size: 15px;
  color: #18384d;
  word-break: break-word;
}

.menu-logout-pill {
  min-height: 38px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid #edc2be;
  border-radius: 999px;
  background:
    linear-gradient(180deg, #fff8f7, #ffeceb),
    #fff6f5;
  color: #8e2f28;
  box-shadow: 0 10px 20px rgba(142, 47, 40, 0.09);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.menu-logout-pill svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.menu-logout-pill:hover {
  transform: translateY(-1px);
  border-color: #e3a8a2;
  box-shadow: 0 14px 24px rgba(142, 47, 40, 0.13);
}

.menu-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #32546e;
}

.menu-section-note {
  color: #5f7284;
  font-size: 14px;
  line-height: 1.45;
}

.menu-action-list {
  display: grid;
  gap: 10px;
}

.menu-action-form {
  margin: 0;
}

.menu-action-form,
.menu-action-form .menu-action-btn {
  width: 100%;
}

.menu-action-link {
  text-decoration: none;
}

.menu-action-btn {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 4px;
  padding: 14px 15px;
  font: inherit;
  cursor: pointer;
  border: 1px solid #d6e6f2;
  border-radius: 18px;
  background:
    linear-gradient(180deg, #ffffff, #eff7fd),
    #fff;
  color: #173d58;
  box-shadow: 0 10px 24px rgba(26, 64, 90, 0.08);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.menu-action-btn:hover {
  transform: translateY(-1px);
  border-color: #a9cfe6;
  box-shadow: 0 14px 28px rgba(26, 64, 90, 0.12);
  background:
    linear-gradient(180deg, #ffffff, #e7f3fb),
    #fff;
}

.menu-action-btn.danger {
  border-color: #edc2be;
  background:
    linear-gradient(180deg, #fff7f6, #ffeceb),
    #fff6f5;
  color: #8e2f28;
}

.menu-action-btn:disabled,
.menu-logout-pill:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.menu-action-btn.is-active {
  border-color: #b9dec1;
  background:
    linear-gradient(180deg, #f7fff8, #ebf8ee),
    #f7fff8;
  color: #22583a;
}

.menu-action-btn.is-warning {
  border-color: #e8d5a5;
  background:
    linear-gradient(180deg, #fffdf4, #fff7dc),
    #fffdf4;
  color: #7a5b11;
}

.menu-action-title {
  display: block;
  font-weight: 700;
  line-height: 1.2;
}

.menu-action-meta {
  display: block;
  color: #64798a;
  font-size: 13px;
  line-height: 1.35;
}

.menu-action-btn.danger .menu-action-meta {
  color: #96504a;
}

.menu-action-btn.is-active .menu-action-meta {
  color: #48715a;
}

.menu-action-btn.is-warning .menu-action-meta {
  color: #886d26;
}

.menu-secondary-btn {
  width: 100%;
  font: inherit;
  cursor: pointer;
  border: 1px solid #d0dfea;
  border-radius: 16px;
  padding: 12px 14px;
  background: #fff;
  color: #355873;
  font-weight: 600;
}

.theme-floating-btn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top, 0px) + 8px);
  right: max(14px, env(safe-area-inset-right, 0px) + 8px);
  z-index: 30;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--tg-border);
  background: rgba(255, 255, 255, 0.86);
  color: #244e68;
  box-shadow: 0 14px 28px rgba(19, 39, 55, 0.16);
  backdrop-filter: blur(12px);
}

.theme-floating-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.menu-secondary-btn:hover {
  background: #f5fafe;
}

@media (max-width: 380px) {
  .menu-user-row {
    align-items: stretch;
    flex-direction: column;
  }

  .menu-logout-pill {
    width: 100%;
  }
}

.menu-panel .settings-form {
  gap: 10px;
}

.menu-panel .settings-form button { width: 100%; }

.messages {
  height: 100%;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(180deg, #edf3f8 0%, #e7edf3 100%);
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.scroll-bottom-btn {
  position: absolute;
  right: 14px;
  bottom: 16px;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #2aa8ea, #1686c2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 32px rgba(9, 73, 109, 0.28);
  opacity: 0;
  transform: translateY(12px) scale(0.92);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
  z-index: 6;
}

.scroll-bottom-btn.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.scroll-bottom-btn:hover {
  background: linear-gradient(180deg, #38b0ee, #178fce);
  box-shadow: 0 18px 34px rgba(9, 73, 109, 0.34);
}

.scroll-bottom-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.msg {
  max-width: min(82%, 520px);
  border-radius: 12px;
  padding: 8px 10px;
  border: 1px solid var(--tg-border);
  white-space: pre-wrap;
  word-break: break-word;
  touch-action: pan-y;
}

.msg.me {
  align-self: flex-end;
  background: var(--tg-user);
}

.msg.bot {
  align-self: flex-start;
  background: var(--tg-bot);
}

.msg.admin {
  align-self: flex-start;
  background: var(--tg-admin);
}

.msg time {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #6c7a89;
  text-align: right;
}

.msg-text a {
  color: #1569a8;
  text-decoration: underline;
}

.msg-text b {
  font-weight: 700;
}

.msg-media {
  display: block;
  max-width: 100%;
  border-radius: 10px;
  margin-top: 6px;
}

video.msg-media {
  background: rgba(24, 42, 58, 0.08);
}

video.msg-media.is-lazy-pending {
  min-height: 184px;
  background:
    radial-gradient(circle at top right, rgba(34, 158, 217, 0.18), transparent 42%),
    linear-gradient(180deg, rgba(225, 235, 243, 0.9), rgba(211, 223, 233, 0.95));
}

.msg > .msg-media:first-child {
  margin-top: 0;
}

.msg-doc {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #1d4ed8;
  color: #fff;
  text-decoration: none;
}

.msg-inline-controls {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.is-support-room .msg-inline-controls,
.is-support-room .msg-actions {
  display: none;
}

.msg-reply {
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-left: 3px solid #229ed9;
  border-radius: 10px;
  background: rgba(34, 158, 217, 0.08);
}

.msg-reply-author {
  font-size: 12px;
  font-weight: 700;
  color: #176896;
}

.msg-reply-text {
  font-size: 12px;
  color: #4c5e70;
  line-height: 1.35;
}

.msg-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.msg-reply-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #d6e5f0;
  border-radius: 10px;
  background: #fff;
  color: #567289;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(14, 46, 69, 0.06);
  touch-action: pan-y;
}

.msg-reply-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.msg-reply-btn:hover {
  color: #166089;
  border-color: #b8d8ea;
  background: #f7fbff;
}

.msg-inline-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}
