:root {
  --bg: #080d1c;
  --glass: rgba(255, 255, 255, 0.06);
  --accent: #9ef2b0;
  --accent-2: #6fd3ff;
  --accent-3: #ff8fb1;
  --text: #f3f7ff;
  --muted: #9fb0c5;
  --bubble-self: linear-gradient(135deg, #9ef2b0, #6fd3ff);
  --bubble-other: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --nav-token-height: 32px;
  --nav-height: 64px;
  --footer-height: 56px;
  --bottom-gutter: 16px;
  --bubble-avatar-size: 34px;
  --ui-font-family: 'Space Grotesk', 'Segoe UI', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  --ui-font-size: 16px;
}


:root[data-bs-theme="light"] {
  --bg: #f6f8fb;
  --glass: rgba(255, 255, 255, 0.8);
  --accent: #2f80ed;
  --accent-2: #56ccf2;
  --accent-3: #f2994a;
  --text: #0b1a2d;
  --muted: #4b5563;
  --bubble-self: linear-gradient(135deg, #2f80ed, #56ccf2);
  --bubble-other: linear-gradient(135deg, rgba(0,0,0,0.04), rgba(0,0,0,0.02));
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

html, body {
  background: radial-gradient(circle at 20% 20%, rgba(142, 242, 195, 0.08), transparent 35%),
              radial-gradient(circle at 80% 10%, rgba(123, 196, 255, 0.08), transparent 30%),
              radial-gradient(circle at 50% 90%, rgba(255, 255, 255, 0.05), transparent 25%),
              var(--bg);
  color: var(--text);
  font-family: var(--ui-font-family, 'Space Grotesk', 'Segoe UI', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif);
  font-size: var(--ui-font-size, 16px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
[data-bs-theme="light"] body {
  background: #f6f8fb;
}
main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.auth-page-row {
  min-height: calc(100vh - var(--nav-height) - var(--footer-height) - 2rem);
  padding-block: 1rem;
}

.auth-page-row .col-lg-5,
.auth-page-row .col-lg-6 {
  width: 100%;
  max-width: 480px;
}
main > .container-fluid {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.auth-page main {
  flex: 1;
}

body.auth-page main > .container-fluid {
  min-height: calc(100vh - var(--nav-height, 64px) - var(--footer-height, 56px));
}

.landing-hero.auth-hero {
  min-height: calc(100vh - var(--nav-height, 64px) - var(--footer-height, 56px));
  padding-top: 2rem;
  padding-bottom: 2rem;
}


.navbar-glass {
  background: linear-gradient(90deg, rgba(158, 242, 176, 0.08), rgba(111, 211, 255, 0.08)) rgba(10, 15, 25, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
  font-family: 'Space Grotesk', 'Segoe UI', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}
[data-bs-theme="light"] .navbar-glass {
  background: linear-gradient(90deg, rgba(47, 128, 237, 0.08), rgba(86, 204, 242, 0.08)) rgba(10, 15, 25, 0.9);
}
.navbar-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(158, 242, 176, 0.08), transparent 50%),
              radial-gradient(circle at 80% 0%, rgba(111, 211, 255, 0.12), transparent 40%);
  pointer-events: none;
}
.navbar-glass .navbar-brand { color: #fff !important; }
[data-bs-theme="light"] .navbar-glass .navbar-brand { color: #fff !important; }

.navbar-app-name {
  font-weight: 600;
  letter-spacing: 0.02em;
}

@media (max-width: 768px) {
  .navbar-app-name {
    display: none;
  }
  body.auth-page .navbar-app-name {
    display: inline;
  }
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
.quick-action-btn {
  flex: 1;
}
.logout-btn {
  border-color: #fff;
  color: #fff;
}
.logout-btn:hover,
.logout-btn:focus-visible {
  border-color: #fff;
  color: #fff;
}

.users-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding-top: 0.75rem;
}

#groupSidebar .contact-list.list-group {
  border: none;
}

.landing-hero {
  position: relative;
  min-height: calc(100vh - var(--nav-height, 64px) - var(--footer-height, 56px));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem 3rem;
  overflow: hidden;
  background: radial-gradient(circle at 20% 20%, rgba(158, 242, 176, 0.12), transparent 45%),
              radial-gradient(circle at 80% 0%, rgba(111, 211, 255, 0.15), transparent 40%),
              linear-gradient(145deg, rgba(8, 12, 24, 0.9), rgba(5, 10, 22, 0.95));
}
.landing-hero .row {
  width: 100%;
  justify-content: center;
  margin-left: 0;
  margin-right: 0;
  margin: 0 auto;
}

.landing-hero__content {
  width: min(1200px, 100%);
  margin: 0 auto;
  display: flex;
  justify-content: center;
}
.landing-hero__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(158, 242, 176, 0.3), transparent 55%),
              radial-gradient(circle at 70% 60%, rgba(111, 211, 255, 0.25), transparent 50%);
  filter: blur(40px);
  animation: glowPulse 16s linear infinite;
  pointer-events: none;
}
.landing-hero__particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.landing-hero__particles span {
  position: absolute;
  display: block;
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  animation: drift 18s linear infinite;
}
.landing-hero__particles span:nth-child(odd) {
  background: rgba(111, 211, 255, 0.25);
}
.landing-hero__particles span:nth-child(1) { top: 10%; left: 12%; animation-delay: 0s; }
.landing-hero__particles span:nth-child(2) { top: 25%; left: 80%; animation-delay: 2s; }
.landing-hero__particles span:nth-child(3) { top: 65%; left: 20%; animation-delay: 5s; }
.landing-hero__particles span:nth-child(4) { top: 40%; left: 55%; animation-delay: 7s; }
.landing-hero__particles span:nth-child(5) { top: 70%; left: 75%; animation-delay: 11s; }
.landing-hero__particles span:nth-child(6) { top: 15%; left: 60%; animation-delay: 14s; }
.landing-card {
  position: relative;
  z-index: 2;
  overflow: hidden;
  background: rgba(5, 10, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 50px rgba(0, 0, 0, 0.55);
  animation: slideIn 0.8s ease;
  width: min(720px, 90vw);
  max-width: 720px;
  max-height: calc(100vh - var(--nav-height, 64px) - var(--footer-height, 56px) - 4rem);
  overflow-y: auto;
}
.landing-logo {
  width: clamp(120px, 25vw, 180px);
  animation: float 6s ease-in-out infinite;
}
.landing-card h1 {
  animation: shimmer 3s linear infinite;
}
.landing-card .btn-soft,
.landing-card .btn-outline-light {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.landing-card .btn-soft:hover,
.landing-card .btn-outline-light:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.landing-card .btn-soft:focus-visible,
.landing-card .btn-outline-light:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
@keyframes glowPulse {
  0% {
    transform: scale(0.95);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.6;
  }
}
@keyframes drift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(20px, -10px, 0);
  }
  100% {
    transform: translate3d(-20px, 10px, 0);
  }
}
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}
@keyframes shimmer {
  0% {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: none;
  }
  50% {
    color: #d0f4ff;
    text-shadow: 0 0 12px rgba(208, 244, 255, 0.5);
  }
  100% {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: none;
  }
}
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-hero {
  min-height: calc(100vh - var(--nav-height, 64px));
  padding: 0;
}

.auth-hero .auth-page-row {
  min-height: 100%;
  padding-block: 0;
}

.auth-hero .col-lg-5,
.auth-hero .col-lg-6,
.auth-hero .col-lg-7 {
  width: 100%;
  max-width: 720px;
}

@media (max-width: 768px) {
  .navbar-app-name {
    display: none;
  }
}

.navbar-glass .chip,
.navbar-glass .btn,
.navbar-glass .nav-inline-scroll span,
.navbar-glass .nav-inline-scroll a {
  font-family: inherit;
  font-weight: 500;
}

.error-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at top, rgba(158, 242, 176, 0.06), rgba(10, 15, 25, 0.95));
}
.error-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #f3f7ff;
  font-weight: 600;
}
.error-actions .btn {
  min-width: 120px;
}
.error-humor {
  opacity: 0.85;
}

.navbar-glass .nav-inline-scroll .btn,
.navbar-glass .chip,
.navbar-glass .btn,
.navbar-glass .nav-inline-scroll span,
.navbar-glass .nav-inline-scroll a {
  font-family: inherit !important;
}

.fancy-nav .fancy-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.nav-inline-scroll {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
  justify-content: flex-end;
}
.nav-inline-scroll::-webkit-scrollbar { display: none; }

@media (min-width: 992px) {
  .navbar-glass {
    padding-block: 0.35rem;
    min-height: 0;
  }
  .navbar-app-name {
    display: inline;
  }
  .navbar-glass .container-fluid {
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
  }
  .fancy-bar {
    gap: 6px;
  }
  .nav-inline-scroll {
    padding: 0;
  }
}

.load-older-banner {
  background: var(--glass);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.35rem 1rem;
  border-radius: 0 0 18px 18px;
}
.load-older-banner .btn-soft {
  padding-inline: 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.fancy-nav .brand-row { position: relative; z-index: 1; }
.fancy-bar .navbar-brand { padding-right: 4px; }
.nav-logo {
  width: var(--nav-token-height);
  height: var(--nav-token-height);
  object-fit: contain;
  display: block;
}
.navbar-brand {
  overflow: hidden;
}
.brand-glow {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 6px rgba(158, 242, 176, 0.25), 0 0 18px rgba(111, 211, 255, 0.35);
}
.pill-status {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 12px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  min-height: var(--nav-token-height);
}
.dot-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #34d399;
  position: relative;
  display: inline-block;
  box-shadow: 0 0 0 rgba(52, 211, 153, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.9rem;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  min-height: var(--nav-token-height);
}
.chip i { opacity: 0.8; }
.chip-secure { border-color: rgba(158, 242, 176, 0.5); }
.chip-user { border-color: rgba(111, 211, 255, 0.45); }
.chip-tight { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-bs-theme="light"] .navbar-glass .chip {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border-color: currentColor;
}
[data-bs-theme="light"] .navbar-glass .chip i { color: #fff; opacity: 0.95; }
[data-bs-theme="light"] .navbar-glass .chip-secure { border-color: rgba(158, 242, 176, 0.6); }
[data-bs-theme="light"] .navbar-glass .chip-user { border-color: rgba(111, 211, 255, 0.6); }
.nav-chip {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 12px;
  padding: 0.32rem 0.85rem;
  min-height: calc(var(--nav-token-height) + 2px);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
}
.nav-chip i { color: #fff; }
.nav-chip-warn {
  border-color: rgba(255, 143, 177, 0.5);
  background: linear-gradient(135deg, rgba(255, 143, 177, 0.25), rgba(242, 187, 92, 0.22));
  color: #fff;
  border-radius: 12px;
  padding: 0.32rem 0.85rem;
  min-height: calc(var(--nav-token-height) + 2px);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
[data-bs-theme="light"] .navbar-glass .nav-chip {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.32);
  color: #fff;
  border-radius: 12px;
  padding: 0.32rem 0.85rem;
  min-height: calc(var(--nav-token-height) + 2px);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
[data-bs-theme="light"] .navbar-glass .nav-chip-warn {
  background: linear-gradient(135deg, rgba(255, 143, 177, 0.3), rgba(242, 187, 92, 0.28));
  border-color: rgba(255, 143, 177, 0.6);
  border-radius: 12px;
  padding: 0.32rem 0.85rem;
  min-height: calc(var(--nav-token-height) + 2px);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.12);
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar.avatar-sm { width: 28px; height: 28px; }
.avatar.avatar-lg { width: 64px; height: 64px; }
.user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ef2b0;
  box-shadow: 0 0 0 4px rgba(158, 242, 176, 0.18);
  display: inline-block;
  animation: pulse 2s infinite;
}
.user-dot-sm {
  width: 7px;
  height: 7px;
  box-shadow: 0 0 0 3px rgba(158, 242, 176, 0.16);
}
.btn-ghost {
  border-radius: 12px;
  padding: 6px 12px;
  border-color: rgba(255, 255, 255, 0.2) !important;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  min-height: var(--nav-token-height);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-ghost:hover { transform: translateY(-1px); }
[data-bs-theme="light"] .btn-ghost { background: rgba(255, 255, 255, 0.9); color: #0b1a2d; border-color: rgba(0,0,0,0.08) !important; }

@media (max-width: 768px) {
  .navbar .badge, .chip { font-size: 0.82rem; padding: 6px 10px; }
  .fancy-nav .container-fluid { padding-inline: 14px; }
  .navbar-brand { font-size: 1.05rem; }
  #chat-panel h5#chat-title { font-size: 1rem; }
}
@media (max-width: 576px) {
  .btn-ghost { padding-inline: 10px; }
  .pill-status { font-size: 0.75rem; padding: 5px 10px; }
  .chip-user {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
  }
  .nav-inline-scroll {
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
  }
  .nav-inline-scroll .nav-token {
    flex: 0 1 auto;
  }
  .nav-inline-scroll .nav-chip,
  .nav-inline-scroll .btn-ghost {
    padding-inline: 8px;
  }
}

@media (max-width: 480px) {
  .nav-inline-scroll {
    gap: 0.25rem;
  }
  .nav-inline-scroll .chip,
  .nav-inline-scroll .btn-ghost {
    padding-inline: 6px;
    min-width: 0;
  }
  .nav-inline-scroll .chip span:not(.dot-pulse),
  .nav-inline-scroll .btn-ghost span {
    display: none;
  }
  .chip-user {
    max-width: 110px;
  }
}

.navbar .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 10px;
  font-size: 0.85rem;
}

.modal-schedule {
  background: var(--glass);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.modal-schedule .btn-close { filter: invert(1); }
.modal-schedule .modal-header,
.modal-schedule .modal-footer { border: 0; }
[data-bs-theme="light"] .modal-schedule {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}
[data-bs-theme="light"] .modal-schedule .modal-title { color: #0b1a2d; }
[data-bs-theme="light"] .modal-schedule .btn-close { filter: invert(0); }

#vault-result {
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.vault-result-highlight {
  box-shadow: 0 0 0 3px rgba(142, 242, 195, 0.8);
  transform: translateY(-4px);
}

.vault-landing {
  min-height: calc(100vh - var(--nav-height, 64px) - var(--footer-height, 56px));
  padding-block-start: calc(var(--nav-height, 64px) + 1.5rem);
  padding-block-end: calc(var(--footer-height, 56px) + 1.5rem);
  padding-inline: clamp(1rem, 4vw, 2.5rem);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  scroll-margin-top: calc(var(--nav-height, 64px) + 0.5rem);
}
.vault-stage {
  width: min(1100px, 100%);
  border-radius: 1.6rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01)),
    rgba(10, 12, 22, 0.9);
  padding: clamp(1.5rem, 2.5vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  box-shadow: 0 30px 90px rgba(4, 6, 12, 0.8);
}
.vault-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.vault-hero-text {
  flex: 1;
  min-width: 260px;
}
.vault-hero-text h3 {
  font-size: clamp(1.35rem, 2.3vw, 1.75rem);
  margin-bottom: 0.25rem;
}
.vault-hero-list {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
  display: grid;
  gap: 0.35rem;
}
.vault-hero-list li {
  position: relative;
  padding-left: 1.6rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.92rem;
}
.vault-hero-list li::before {
  content: '\\2022';
  position: absolute;
  left: 0;
  top: 0;
  font-size: 1rem;
  color: var(--accent-2, #6fd3ff);
}
.vault-hero-status {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-end;
  text-align: right;
}
.vault-body {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1rem, 2vw, 1.5rem);
}
.vault-panel {
  min-height: 0;
  padding: clamp(1.1rem, 2vw, 1.4rem);
  border-radius: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 12, 22, 0.85);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
}
.vault-panel .input-group {
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.1rem;
}
.vault-panel .input-group .form-control {
  min-width: 0;
}
.vault-panel .form-control {
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.vault-panel .form-control:focus,
.vault-panel .form-control:hover {
  background: rgba(255, 255, 255, 0.12);
}
.vault-alert-wrapper {
  min-height: 1.5rem;
}
#vault-metadata {
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.2rem;
}
.vault-output-panel .vault-output-header h5 {
  font-size: 1.1rem;
}
.vault-output-header {
  flex-wrap: wrap;
}
.vault-output {
  margin-top: 0.25rem;
}
.vault-output pre {
  min-height: 180px;
  max-height: 360px;
  overflow-y: auto;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(11, 16, 28, 0.9);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
.vault-output pre::selection {
  background: rgba(158, 242, 195, 0.25);
}
#vault-content {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font-family: inherit;
}
.vault-file {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1rem;
}
.vault-file .btn {
  border-radius: 999px;
}
.vault-file .d-flex {
  flex-wrap: wrap;
}
.vault-output-hint {
  max-width: 220px;
}
.vault-field-heading {
  display: block;
  margin-bottom: 0.35rem;
}
.vault-field-label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  display: inline-block;
}
.vault-field-caption {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 400;
}
.vault-title-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}
.vault-title-value {
  font-size: 1rem;
  letter-spacing: normal;
  color: var(--text);
  font-weight: 500;
}

.vault-panel + .vault-panel {
  flex: 1 1 320px;
}

[data-bs-theme="light"] .vault-field-caption {
  color: rgba(15, 23, 42, 0.75);
}
[data-bs-theme="light"] .vault-title-line {
  color: rgba(15, 23, 42, 0.65);
}

@media (max-width: 768px) {
  .vault-landing {
    padding-block-start: calc(var(--nav-height, 64px) + 1rem);
    padding-block-end: calc(var(--footer-height, 56px) + 1rem);
  }
  .vault-stage {
    padding: 1.25rem;
  }
  .vault-hero-status {
    flex: 1 1 100%;
    align-items: flex-start;
    text-align: left;
  }
  .vault-body {
    flex-direction: column;
  }
}
@media (max-width: 576px) {
  .vault-stage {
    padding: 1rem;
  }
  .vault-panel {
    padding: 1rem;
  }
  .vault-panel .input-group {
    flex-direction: column;
  }
  .vault-panel .input-group .form-control,
  .vault-panel .input-group .btn {
    width: 100%;
    border-radius: 0.75rem;
  }
  .vault-output pre {
    max-height: 260px;
  }
}

.card-glass {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  border-radius: 18px;
}

.doc-card {
  border-color: rgba(255, 255, 255, 0.12);
}
.doc-card .card-title {
  font-size: 1rem;
  letter-spacing: 0.01em;
  text-transform: capitalize;
  font-weight: 600;
  color: inherit;
}
.doc-card .doc-btn {
  border-radius: 999px;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}
[data-bs-theme="light"] .doc-card {
  border-color: rgba(15, 23, 42, 0.2);
}

.backend-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 12, 22, 0.85);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
[data-bs-theme="light"] .backend-overlay {
  background: rgba(255, 255, 255, 0.92);
}
.backend-overlay-card {
  max-width: 460px;
  width: 100%;
  text-align: center;
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 25px 40px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.backend-overlay-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.backend-overlay-text {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.backend-overlay-retry {
  min-width: 140px;
}

.btn-soft {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #041523;
  font-weight: 600;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.btn-soft:hover { transform: translateY(-1px); box-shadow: 0 10px 25px rgba(142, 242, 195, 0.35); }

.form-control, .form-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}
[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select {
  background: rgba(255, 255, 255, 0.92);
  color: #0b1a2d;
  border-color: rgba(0,0,0,0.08);
}

#join-inline .form-control {
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 2px rgba(111,211,255,0.12);
}
#join-inline .form-control:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(111,211,255,0.2);
}

.contact-list { max-height: 75vh; overflow-y: auto; }
.contact-list .list-group-item .username {
  color: #ffffff;
  font-weight: 600;
}
[data-bs-theme="light"] .contact-list .list-group-item .username {
  color: #0b1a2d;
}
.contact-list .btn-link {
  text-decoration: none;
}
.contact-list .btn-link:hover,
.contact-list .btn-link:focus {
  text-decoration: none;
}
.favorites-title i {
  color: #ffffff;
}
.doc-label {
  text-transform: lowercase;
}
.top-menu-btn {
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

.message-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 23, 0.35);
  backdrop-filter: blur(6px);
  pointer-events: none;
  border-radius: 18px;
  z-index: 5;
  transition: opacity 0.2s ease;
}
.message-loading.d-none { opacity: 0; }
.message-loading:not(.d-none) { opacity: 1; }

.text-accent { color: var(--accent) !important; }
.bubble.ai {
  border: 1px dashed rgba(111, 211, 255, 0.35);
  background: rgba(111,211,255,0.08);
}
.ai-thinking {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ai-thinking .spinner-border {
  width: 1.25rem;
  height: 1.25rem;
  border-width: 0.15em;
}
.action-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.action-stack .action-icon {
  font-size: 1.9rem;
  line-height: 1;
}
.action-stack .action-text {
  font-weight: 700;
}

.bubble {
  padding: 0.9rem 1.1rem;
  border-radius: 18px;
  max-width: 640px;
  width: fit-content;
  position: relative;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  word-break: break-word;
  will-change: transform, opacity;
}

.bubble.new-message {
  animation: fadeUp 0.25s ease both;
  animation-delay: var(--bubble-delay, 0s);
  opacity: 0;
}

.bubble.long-text {
  max-width: 100%;
  width: 100%;
  text-align: left;
  text-justify: auto;
  hyphens: none;
  line-height: 1.5;
}
.bubble-avatar {
  width: var(--bubble-avatar-size);
  height: var(--bubble-avatar-size);
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}
.bubble-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
[data-bs-theme="light"] .bubble-avatar {
  border-color: rgba(10, 15, 25, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.message-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  max-width: 680px;
  justify-content: flex-start;
}
.message-row.self {
  justify-content: flex-end;
  margin-left: auto;
}
@media (max-width: 576px) {
  .bubble.media-wide {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0;
    margin-right: 0;
  }
}

.bubble.self { margin-left: auto; background: linear-gradient(135deg, rgba(158,242,176,0.16), rgba(111,211,255,0.16)); color: #f3f7ff; border: 1px solid rgba(158,242,176,0.35); }
.bubble.other { margin-right: auto; background: rgba(16,24,40,0.7); color: #f3f7ff; backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,0.05); }
[data-bs-theme="light"] .bubble.self { color: #0b1a2d; border-color: rgba(47,128,237,0.35); }
[data-bs-theme="light"] .bubble.other { background: rgba(255,255,255,0.9); color: #0b1a2d; border: 1px solid rgba(0,0,0,0.05); box-shadow: 0 10px 15px rgba(0,0,0,0.08); }
[data-bs-theme="light"] .bubble.self { color: #0b1a2d; border-color: rgba(47,128,237,0.35); }
[data-bs-theme="light"] .bubble.other { background: rgba(255,255,255,0.9); color: #0b1a2d; border: 1px solid rgba(0,0,0,0.05); box-shadow: 0 10px 15px rgba(0,0,0,0.08); }

.bubble .meta { font-size: 0.8rem; color: var(--muted); }
.bubble .actions button {
  border-radius: 999px;
  min-width: 40px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font-size: 0.85rem;
}
.bubble .actions .copy-btn {
  margin-top: 0 !important;
  align-self: center;
}
.bubble .actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
  align-items: center;
}
@media (max-width: 576px) {
  .bubble .actions {
    gap: 4px;
    flex-wrap: nowrap;
  }
  .bubble .actions button {
    flex: 1 1 0;
    min-width: 0;
    padding: 4px 6px;
    height: 32px;
    font-size: 0.78rem;
    white-space: nowrap;
  }
}

.favorite-btn i {
  color: #34d399;
}

.bubble code {
  font-family: 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
  background: rgba(255, 255, 255, 0.08);
  color: #e8f4ff;
  padding: 0.1rem 0.35rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
[data-bs-theme="light"] .bubble code {
  background: #f0f3fa;
  color: #0b1a2d;
  border-color: rgba(0,0,0,0.05);
}

.code-block {
  width: 100%;
  margin-top: 0.5rem;
  background: rgba(6, 10, 24, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0,0,0,0.28);
}
[data-bs-theme="light"] .code-block {
  background: #f8fafd;
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.code-block__meta {
  display: flex;
  justify-content: flex-end;
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(120deg, rgba(158,242,176,0.12), rgba(111,211,255,0.12));
}
[data-bs-theme="light"] .code-block__meta {
  border-color: rgba(0,0,0,0.06);
  background: linear-gradient(120deg, rgba(47,128,237,0.08), rgba(86,204,242,0.08));
}

.code-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.1rem 0.6rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.08);
  color: #e8f4ff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}
[data-bs-theme="light"] .code-pill {
  background: rgba(255,255,255,0.9);
  color: #0b1a2d;
  border-color: rgba(0,0,0,0.06);
}

.code-block pre {
  margin: 0;
  padding: 0.9rem;
  overflow-x: auto;
  font-family: 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre;
  tab-size: 2;
}
.code-block code {
  background: transparent;
  border: none;
  color: #e8f4ff;
  display: block;
  padding: 0;
}
[data-bs-theme="light"] .code-block code {
  color: #0b1a2d;
}

.code-kw { color: #9bd2ff; font-weight: 700; }
.code-str { color: #ffd580; }
.code-cmt { color: #9aa5b1; font-style: italic; }
.code-num { color: #c3f3ff; }
[data-bs-theme="light"] .code-kw { color: #2f80ed; }
[data-bs-theme="light"] .code-str { color: #b85c00; }
[data-bs-theme="light"] .code-cmt { color: #6b7280; }
[data-bs-theme="light"] .code-num { color: #0f9ed5; }
@media (max-width: 480px) {
  .bubble .actions button {
    min-width: 32px;
    height: 28px;
    padding: 0 6px;
    flex: 0 0 auto;
    font-size: 0.8rem;
  }
  .bubble .actions {
    gap: 4px;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
}
.reaction-like { color: #ff6fa2; border-color: #ff6fa2; }
.reaction-dislike { color: #7dd3ff; border-color: #7dd3ff; }

/* Toastr styling tweaks */
.toast {
  border-radius: 14px !important;
  overflow: hidden;
}
.toast-success { border: 1px solid rgba(158, 242, 176, 0.4); }
.toast-info { border: 1px solid rgba(111, 211, 255, 0.35); }
.toast-warning { border: 1px solid rgba(242, 187, 92, 0.5); }
.toast-error { border: 1px solid rgba(255, 143, 177, 0.45); }
.reaction-download { color: #6fd3ff; border-color: #6fd3ff; }
.copy-count { font-size: 0.85rem; }
.reaction-download i,
.reaction-like i,
.reaction-dislike i,
.copy-count,
.like-count,
.dislike-count {
  line-height: 1;
  display: inline-flex;
  align-items: center;
}
.scheduled-row { color: var(--text); }
[data-bs-theme="light"] .scheduled-row { color: #0b1a2d; }
.media-preview img, .media-preview video {
  max-width: 100%;
  max-height: 240px;
  border-radius: 12px;
  object-fit: cover;
  margin: 0 auto;
  display: block;
}
.media-preview iframe { border: none; border-radius: 12px; }
.media-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}
.media-preview .media-preview-body { width: 100%; }
.media-preview.media-audio {
  flex-direction: column;
  align-items: center;
}
.media-preview.media-audio audio {
  width: 100%;
}
.media-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  z-index: 1;
}
[data-bs-theme="light"] .media-spinner {
  background: rgba(255, 255, 255, 0.6);
}
.filename-row {
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: center;
}
.media-preview audio {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.85);
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}
#mediaModalBody {
  position: relative;
}
.media-modal-heart {
  pointer-events: none;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(3rem, 8vw, 4.5rem);
  color: rgba(255, 115, 175, 0.95);
  opacity: 0;
  transform: scale(0);
  z-index: 2;
}
.media-modal-heart-active {
  animation: media-modal-heart-pop 0.65s ease-out;
}
@keyframes media-modal-heart-pop {
  0% {
    opacity: 0;
    transform: scale(0.35);
  }
  25% {
    opacity: 1;
    transform: scale(1.25);
  }
  70% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.9);
  }
}
.input-card .btn-danger { background: #ef4444; color: #fff; }
.group-badge {
  width: 10px;
  height: 10px;
  background: #ff6fa2;
  border-radius: 50%;
  display: inline-block;
}

.input-card { border-radius: 18px; }
.sticky-input {
  position: sticky;
  bottom: 0;
  z-index: 10;
  margin-top: auto;
  width: 100%;
}

@media (max-width: 768px) {
  /* Prevent keyboard-induced repositioning on phones */
  .sticky-input {
    position: static;
  }
}
.input-row { align-items: stretch !important; }
.send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 1rem;
  padding-right: 1rem;
  min-width: 48px;
  color: #041523;
}
.send-btn i {
  color: inherit;
  transition: color 0.2s ease;
}
.send-btn:focus-visible,
.send-btn:active {
  color: #041523;
}
.button-stack { display: none; }
.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 4px;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  max-width: 340px;
  max-height: 420px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
  gap: 6px;
  z-index: 10;
}
.emoji-picker button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 18px;
  line-height: 1.2;
  width: 100%;
  height: 36px;
}

.emoji-picker {
  max-width: 340px;
  max-height: 420px;
}

.secret-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: #64748b; }
.secret-dot.on { background: #4ade80; box-shadow: 0 0 12px rgba(74, 222, 128, 0.45); }
.mention { background: rgba(159, 242, 176, 0.25); color: #043227; padding: 0 6px; border-radius: 999px; font-weight: 600; }
.action-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-style: italic;
  font-weight: 600;
  color: var(--text);
  flex-direction: column;
}
.action-box .action-icon {
  font-size: 28px;
  line-height: 1.1;
}
.action-gif {
  max-width: 200px;
  width: 100%;
  display: block;
  margin: 6px auto 0;
  border-radius: 8px;
}

.notification-dot {
  position: absolute;
  top: 6px;
  right: 10px;
  width: 10px;
  height: 10px;
  background: #ff8fb1;
  border-radius: 50%;
}
.notification-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ff8fb1;
  color: #0a0f1c;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 700;
}

.login-logo {
  width: 120px;
  height: auto;
  display: inline-block;
}
.register-logo {
  width: 120px;
  height: 120px;
  display: inline-block;
  object-fit: contain;
}
.landing-logo {
  width: 120px;
  height: auto;
  display: inline-block;
  object-fit: contain;
}

/* Light theme overrides for visibility */
[data-bs-theme="light"] .text-light,
[data-bs-theme="light"] .list-group-item.text-light,
[data-bs-theme="light"] .btn-link.text-light {
  color: #0b1a2d !important;
}
[data-bs-theme="light"] .btn-outline-light {
  color: #0b1a2d;
  border-color: #0b1a2d;
}
[data-bs-theme="light"] .navbar-dark .navbar-brand,
[data-bs-theme="light"] .navbar-dark .navbar-nav .nav-link {
  color: #0b1a2d;
}
[data-bs-theme="light"] .card-glass,
[data-bs-theme="light"] .message-list,
[data-bs-theme="light"] .chat-shell {
  color: #0b1a2d;
}

.bg-gradient { min-height: 100vh; }

body.auth-page {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

body.auth-page main {
  height: auto;
  min-height: calc(100vh - var(--nav-height) - var(--footer-height));
  overflow: auto;
}

body.auth-page .container-fluid {
  flex: 1;
}

@media (min-height: 720px) {
.qr-page {
  max-height: calc(100vh - var(--nav-height) - var(--footer-height) - 2rem);
  overflow-y: auto;
  padding-bottom: 1rem;
}
}

main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
  min-height: calc(100vh - var(--nav-height) - var(--footer-height) - var(--bottom-gutter));
  height: calc(100vh - var(--nav-height) - var(--footer-height) - var(--bottom-gutter));
  overflow: hidden;
}

main .container,
main .container-fluid {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-shell {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: stretch;
  width: min(100%, calc(100vw - 1rem));
  margin-inline: auto;
  padding-inline: 0.5rem;
  min-height: 0;
  height: 100%;
}

.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

#groupSidebar.desktop-spaces {
  overflow-y: auto;
  max-height: 100%;
  height: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.message-list::-webkit-scrollbar,
.sidebar-column::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#groupSidebar.desktop-spaces::-webkit-scrollbar {
  width: 0;
  height: 0;
}

@media (max-width: 991px) {
  .message-list,
  #groupSidebar.desktop-spaces {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .message-list::-webkit-scrollbar,
  #groupSidebar.desktop-spaces::-webkit-scrollbar,
  .sidebar-column::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
}

.chat-area {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.35rem;
}

.chat-card {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.chat-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.message-area {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scroll-control-wrapper {
  padding-right: 0.5rem;
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: transparent;
}

.message-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 1rem 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2rem;
  scroll-behavior: smooth;
}

.scroll-top-btn {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1a2d;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  display: inline-flex;
  opacity: 0;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 10;
  margin-left: auto;
}
.scroll-top-btn.show {
  opacity: 0.55;
  pointer-events: auto;
}
.scroll-top-btn.active {
  opacity: 1;
}
.scroll-top-btn:hover { transform: translateY(-2px); }
.scroll-top-btn:active { transform: translateY(0); }

.app-footer {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  margin-top: 0rem;
  flex-shrink: 0;
}

.chat-shell.sidebar-hidden {
  grid-template-columns: 1fr;
}

.chat-shell.sidebar-hidden #groupSidebar {
  display: none;
}

#groupSidebar.sidebar-collapsed {
  display: none;
}

@media (max-width: 991px) {
  .chat-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  .desktop-spaces {
    order: 0;
    width: 100%;
    flex: none;
  }
  .chat-area {
    order: 1;
    width: 100%;
    flex: 1 1 auto;
  }
  .sidebar-column {
    height: auto;
    max-height: none;
  }
  #groupSidebar {
    position: static;
    display: none;
    width: 100%;
    max-width: 100%;
    transform: none;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    overflow: visible !important;
    max-height: none !important;
    z-index: auto;
  }
  .chat-shell.sidebar-expanded #groupSidebar {
    display: block;
  }
  #groupSidebar.sidebar-collapsed {
    display: none;
  }
  #groupSidebar .contact-list,
  #groupSidebar .sidebar-card {
    overflow: visible;
    max-height: none;
  }
  #groupSidebar,
  #groupSidebar .contact-list {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  #groupSidebar::-webkit-scrollbar,
  #groupSidebar .contact-list::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
  main {
    min-height: auto;
    height: auto;
    overflow: visible;
  }
  main .container-fluid {
    min-height: 0;
    height: auto;
  }
  .chat-shell {
    width: 100%;
    height: auto;
  }
  .message-list {
    scroll-behavior: auto;
  }
}

@media (min-width: 992px) {
  .chat-shell {
    grid-template-columns: minmax(260px, 320px) 1fr;
  }
  #groupSidebar.desktop-spaces {
    align-self: stretch;
    max-height: 100%;
    height: 100%;
    padding-bottom: 0.5rem;
  }
  .chat-card {
    max-height: 75vh;
  }
  .chat-area {
    position: relative;
  }
  .scroll-control-wrapper {
    position: absolute;
    bottom: calc(var(--bottom-gutter, 1rem) + 6rem);
    right: 1.25rem;
    padding-right: 0;
    background: transparent;
    width: auto;
    z-index: 7;
  }
  .scroll-control-wrapper .scroll-top-btn {
    margin-left: 0;
  }
  main {
    min-height: auto;
  }
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.qr-scanner-video {
  border-radius: 0.75rem;
  background: #000;
  min-height: 320px;
  height: clamp(300px, 60vh, 680px);
  object-fit: cover;
}
.qr-scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 1rem;
}
.qr-scanner-target {
  width: 70%;
  max-width: 260px;
  aspect-ratio: 1 / 1;
  border: 2px solid rgba(158, 242, 176, 0.8);
  border-radius: 1rem;
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.35), 0 0 24px rgba(158, 242, 176, 0.35);
  animation: pulse 1.6s ease-in-out infinite alternate;
}
.qr-card-wrapper {
  width: 100%;
  max-width: clamp(240px, 70vw, 420px);
  margin: 0 auto;
}

#qrScannerModal .modal-content {
  background-color: rgba(12, 15, 22, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.search-result-actionable {
  cursor: pointer;
}
.search-result-actionable:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}
.search-target {
  animation: search-highlight 1.4s ease;
}
@keyframes search-highlight {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 205, 0, 0.8);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 205, 0, 0.3);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 205, 0, 0);
  }
}
#vault-file-view {
  max-height: 60vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.25rem;
}

#vaultModal .modal-dialog {
  max-width: 760px;
  margin: 0 auto;
  min-height: calc(100vh - var(--nav-height, 64px));
  display: flex;
  align-items: center;
}

#vaultModal .modal-body {
  max-height: calc(100vh - var(--nav-height, 64px) - var(--footer-height, 56px) - 5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

#vaultModal .form-select,
#vaultModal .input-group .form-select {
  background-color: rgba(10, 15, 25, 0.95);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

#vaultModal .form-select:focus,
#vaultModal .form-select:focus-visible {
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 0.2rem rgba(111, 211, 255, 0.25);
}

@media (max-width: 768px) {
  #vault-file-view {
    max-height: 45vh;
  }
}
