:root {
  --bg: #0b141a;
  --surface: #111b21;
  --surface-2: #202c33;
  --surface-3: #2a3942;
  --text: #e9edef;
  --muted: #9ba8b0;
  --primary: #25d366;
  --primary-dark: #128c7e;
  --danger: #f15c6d;
  --warning: #ffba08;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  --border: 1px solid rgba(255, 255, 255, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(37, 211, 102, 0.14), transparent 25%),
    radial-gradient(circle at 80% 100%, rgba(18, 140, 126, 0.2), transparent 20%),
    var(--bg);
  color: var(--text);
}

a {
  color: #7ad7ff;
}

#app {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.shell {
  min-height: 100vh;
  padding: 20px;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(520px, 100%);
  border: var(--border);
  border-radius: var(--radius);
  background: rgba(17, 27, 33, 0.88);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  padding: 26px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.logo-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(45deg, var(--primary-dark), var(--primary));
}

.headline {
  margin: 0 0 8px;
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
}

.subtext {
  margin: 0 0 20px;
  color: var(--muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

label {
  font-size: 0.9rem;
  color: var(--muted);
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(37, 211, 102, 0.6);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: 140ms ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
}

.icon-btn i {
  font-size: 16px;
}

.btn-primary {
  background: var(--primary);
  color: #0b141a;
  font-weight: 700;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-secondary {
  background: var(--surface-3);
  color: var(--text);
}

.btn-secondary:hover {
  background: #36515f;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.13);
}

.btn-link {
  background: transparent;
  color: #7ad7ff;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.dashboard {
  min-height: 100vh;
  padding: 14px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  min-width: 0;
}

.dashboard.chat-focus {
  padding: 8px;
  grid-template-rows: 1fr;
}

.dashboard.chat-focus .topbar,
.dashboard.chat-focus>.tabs {
  display: none;
}

.dashboard.chat-focus #user-content.panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.dashboard.chat-focus .chat-layout {
  height: calc(100dvh - 16px);
}

.admin-wa-shell {
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
  gap: 10px;
  height: 100dvh;
}

.admin-icon-rail {
  border: var(--border);
  border-radius: 14px;
  background: rgba(17, 27, 33, 0.85);
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  grid-row: 2;
}

.admin-rail-btn {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-rail-btn i {
  font-size: 18px;
}

.admin-rail-btn.active {
  background: rgba(37, 211, 102, 0.2);
  border-color: rgba(37, 211, 102, 0.48);
  color: #b8ffd1;
}

.admin-main-panel {
  padding: 8px;
}

.admin-main-panel .chat-layout {
  height: calc(100dvh - 120px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: var(--border);
  background: rgba(17, 27, 33, 0.85);
}

.topbar h1 {
  margin: 0;
  font-size: 1.1rem;
}

.muted {
  color: var(--muted);
}

.mobile-menu-btn {
  display: none;
}

.dashboard-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  min-height: 0;
  min-width: 0;
}

.sidebar {
  border: var(--border);
  border-radius: 14px;
  background: rgba(17, 27, 33, 0.85);
  padding: 12px;
}

.sidebar .tabs {
  display: grid;
  gap: 8px;
}

.sidebar .tab-btn {
  width: 100%;
  text-align: left;
  border-radius: 12px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

@media (min-width: 900px) {
  .dashboard-body {
    grid-template-columns: 260px 1fr;
  }

  .sidebar {
    position: static;
    transform: none;
    max-height: none;
    overflow: visible;
  }

  .mobile-menu-btn {
    display: none;
  }
}

@media (max-width: 899px) {
  .dashboard-body {
    position: relative;
  }

  .sidebar {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 20;
    max-height: calc(100vh - 130px);
    overflow: auto;
    transform: translateY(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.sidebar-open {
    transform: translateY(0);
  }

  .mobile-menu-btn {
    display: inline-flex;
  }
}

.tab-btn.active {
  background: rgba(37, 211, 102, 0.2);
  border-color: rgba(37, 211, 102, 0.5);
  color: #b8ffd1;
}

.panel {
  border: var(--border);
  border-radius: 14px;
  background: rgba(17, 27, 33, 0.85);
  padding: 12px;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

.chat-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 12px;
  height: clamp(520px, calc(100dvh - 190px), 860px);
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.chat-sidebar {
  border-right: var(--border);
  min-height: 0;
  overflow: hidden; /* Header stays, body scrolls */
  background: var(--surface);
  z-index: 5;
  display: flex;
  flex-direction: column;
  position: relative;
}

.chat-list-head {
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 4px;
}

.sticky-tab-head {
  border-bottom: var(--border);
  margin-bottom: 12px;
}

.chat-list-head h3 {
  margin: 0;
  font-size: 1rem;
}

.chat-list-search {
  margin: 0;
  padding: 8px 10px 12px;
  background: var(--surface);
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-list-search i {
  color: var(--muted);
}

.chat-list-search input {
  border: 0;
  background: transparent;
  padding: 0;
  min-width: 0;
}

.chat-list-search input:focus {
  box-shadow: none;
}

.chat-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.chat-fab-add {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid rgba(37, 211, 102, 0.5);
  background: linear-gradient(180deg, rgba(37, 211, 102, 0.95), rgba(16, 163, 77, 0.95));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(6, 80, 37, 0.45);
  cursor: pointer;
  z-index: 5;
}

.chat-fab-add i {
  font-size: 18px;
}

.chat-header {
  padding: 8px 12px;
  border-radius: 10px;
  border: var(--border);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.chat-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 0;
  overflow: hidden;
}

.chat-header-copy {
  min-width: 0;
}

.chat-header-copy strong,
.chat-header-copy .muted {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-header-subtitle {
  display: flex;
  flex-direction: column;
  min-height: 1.2em;
}

.typing-indicator {
  display: none;
  font-size: 0.8rem;
  color: #25d366;
  font-weight: 500;
  animation: pulse 1.5s infinite ease-in-out;
}

.typing-indicator.active {
  display: inline-block;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.7;
  }

  50% {
    opacity: 1;
  }
}

.chat-header-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-menu-wrap {
  position: relative;
}

.chat-menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 10;
  min-width: 210px;
  border: var(--border);
  border-radius: 12px;
  background: #1b272f;
  padding: 10px;
  display: grid;
  gap: 8px;
  box-shadow: var(--shadow);
}

.chat-inline-search {
  border: var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.chat-inline-search i {
  color: var(--muted);
}

.chat-inline-search input {
  border: 0;
  background: transparent;
  padding: 0;
}

.chat-inline-search input:focus {
  box-shadow: none;
}

.chat-header-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-left: auto;
}

.switch-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.switch-inline input {
  width: auto;
}

.chat-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.chat-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

.chat-backdrop {
  display: none;
}

.chat-sidebar-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.chat-sidebar-panel .field:last-child,
.chat-sidebar-panel .stack:last-child {
  margin-bottom: 0;
}

.chat-menu-actions {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-bottom: var(--border);
  background: rgba(17, 27, 33, 0.75);
  position: sticky;
  top: 0;
  z-index: 1;
}

.conversation-item {
  border-bottom: var(--border);
  padding: 10px;
  cursor: pointer;
  transition: background 120ms ease;
}

.conversation-item:hover,
.conversation-item.active {
  background: rgba(37, 211, 102, 0.1);
}

.conversation-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.conversation-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #d8f8e4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
}

.conversation-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.conversation-main {
  min-width: 0;
  flex: 1;
}

.conversation-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.conversation-badge {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--primary);
  color: #0b141a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 6px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.25);
}

.conversation-preview {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-preview.typing {
  color: rgba(37, 211, 102, 0.95);
}

.conversation-time {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 4px;
}

.message-list {
  overflow: auto;
  padding: 12px;
  border: var(--border);
  border-radius: 12px;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.015) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.015) 25%, transparent 25%);
  background-size: 28px 28px;
  background-color: rgba(11, 20, 26, 0.8);
  display: grid;
  gap: 8px;
  min-height: 0;
  align-content: start;
}

.message-bubble {
  max-width: min(72ch, 82%);
  border-radius: 12px;
  padding: 8px 10px;
  line-height: 1.35;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.14);
}

.message-self {
  margin-left: auto;
  background: #005c4b;
}

.message-other {
  margin-right: auto;
  background: #202c33;
}

.message-meta {
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  font-size: 0.72rem;
  color: #c8d7dc;
}

.msg-ticks {
  letter-spacing: -1px;
  font-weight: 700;
}

.msg-ticks-sent {
  color: #c8d7dc;
}

.msg-ticks-delivered {
  color: #c8d7dc;
}

.msg-ticks-read {
  color: #53bdeb;
}

.composer {
  border: var(--border);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.composer-row {
  display: flex;
  gap: 8px;
}

.composer-row input[type="text"] {
  flex: 1;
}

.whatsapp-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px;
}

.composer-file {
  display: none;
}

.composer-icon-btn {
  min-width: 42px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.composer-send-btn {
  min-width: 42px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.composer-text {
  flex: 1;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.composer-icon-btn i,
.composer-send-btn i {
  font-size: 17px;
  line-height: 1;
}

.composer-send-btn i {
  font-size: 16px;
}

.composer-icon-btn.is-recording {
  background: var(--danger);
  color: #fff;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.badge.success {
  background: rgba(37, 211, 102, 0.16);
  color: #b8ffd1;
}

.badge.warn {
  background: rgba(255, 186, 8, 0.16);
  color: #ffe18a;
}

.badge.error {
  background: rgba(241, 92, 109, 0.14);
  color: #ffc2cc;
}

.table-wrap {
  overflow: auto;
  border-radius: 10px;
  border: var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.85rem;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  border: var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
}

.stat-card h3 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.stat-card p {
  margin: 8px 0 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.stack {
  display: grid;
  gap: 12px;
}

.chart-frame {
  position: relative;
  min-height: 320px;
  max-height: 520px;
}

.chart-frame canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.link-chip {
  color: #82d8f7;
  background: rgba(130, 216, 247, 0.12);
  border-radius: 8px;
  padding: 8px;
  display: inline-block;
  text-decoration: none;
}

.media-thumb {
  max-width: 260px;
  border-radius: 10px;
  border: var(--border);
  display: block;
}

.media-thumb-video {
  background: #000;
}

.media-trigger {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
  display: inline-flex;
  max-width: 100%;
}

.media-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.84);
  display: grid;
  place-items: center;
  z-index: 120;
}

.media-lightbox-dialog {
  width: min(96vw, 1100px);
  max-height: 92vh;
  position: relative;
  display: grid;
  justify-items: center;
  align-items: center;
}

.media-lightbox-close {
  position: absolute;
  top: -42px;
  right: 0;
}

.media-lightbox-image,
.media-lightbox-video {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 12px;
  border: var(--border);
  background: #000;
}

.audio-pill {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  z-index: 30;
}

.modal {
  width: min(760px, 95vw);
  max-height: 90vh;
  overflow: auto;
  border-radius: 14px;
  border: var(--border);
  background: #111b21;
  padding: 16px;
}

.admin-lightbox {
  width: min(980px, 94vw);
}

.admin-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

#toast-root {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 8px;
  z-index: 200;
}

.toast {
  min-width: 220px;
  max-width: 320px;
  padding: 10px 12px;
  border-radius: 10px;
  border: var(--border);
  background: #1e2a31;
  box-shadow: var(--shadow);
}

.toast.success {
  border-color: rgba(37, 211, 102, 0.4);
}

.toast.error {
  border-color: rgba(241, 92, 109, 0.4);
}

@media (max-width: 900px) {
  .admin-wa-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    gap: 0;
    height: 100dvh;
  }

  .admin-icon-rail {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    height: 64px;
    border-radius: 20px;
    background: rgba(17, 27, 33, 0.9);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .admin-wa-shell.admin-mobile-chat-focus {
    grid-template-rows: 1fr;
  }

  .admin-wa-shell.admin-mobile-chat-focus .admin-icon-rail,
  .admin-wa-shell.admin-full-focus .admin-icon-rail {
    display: none !important;
  }

  .admin-wa-shell.admin-mobile-chat-focus .admin-main-panel,
  .admin-wa-shell.admin-full-focus .admin-main-panel {
    padding: 0;
    height: 100dvh;
    overflow: auto;
  }

  .admin-wa-shell.admin-mobile-chat-focus .admin-main-panel .chat-layout,
  .admin-wa-shell.admin-full-focus .admin-main-panel .chat-layout {
    height: 100dvh;
    margin-bottom: 0;
  }

  .admin-main-panel {
    padding: 0 0 84px;
    height: 100dvh;
    overflow-y: auto;
  }

  .chat-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    height: clamp(460px, calc(100dvh - 240px), 760px);
  }

  .admin-main-panel .chat-layout {
    height: calc(100dvh - 150px);
    margin-bottom: 74px;
  }

  .dashboard.chat-focus .chat-layout {
    height: 100dvh;
  }

  .chat-fab-add {
    right: 14px;
    bottom: 14px;
  }

  .admin-wa-shell:not(.admin-mobile-chat-focus) .chat-fab-add {
    bottom: calc(94px + env(safe-area-inset-bottom));
  }

  .chat-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(84vw, 340px);
    height: 100%;
    max-width: 100%;
    border-right: var(--border);
    border-bottom: 0;
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    z-index: 3;
    box-shadow: var(--shadow);
    background: #111b21;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .admin-mobile-tool-focus .chat-sidebar {
    width: 100%;
    transform: none;
    position: relative;
    height: 100%;
    padding-bottom: 0;
  }

  .chat-layout.chat-layout-sidebar-open .chat-sidebar {
    transform: translateX(0);
  }

  .chat-main {
    grid-column: 1;
    grid-row: 1;
  }

  .chat-menu-btn {
    display: inline-flex;
  }

  .chat-menu-btn i {
    font-size: 18px;
    line-height: 1;
  }

  /* Tighten header on mobile so title + tools fit in one row */
  .chat-header {
    padding: 6px 8px;
    gap: 6px;
  }

  .chat-header-title {
    gap: 6px;
  }

  .chat-header-tools {
    gap: 2px;
  }

  /* Shrink icon-only tool buttons on mobile */
  .chat-header-tools .composer-icon-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .chat-header-tools .composer-icon-btn i {
    font-size: 13px;
  }

  .chat-header-controls {
    width: 100%;
    justify-content: flex-end;
    margin-left: 0;
  }

  .chat-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.38);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    z-index: 2;
  }

  .chat-layout.chat-layout-sidebar-open .chat-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .admin-main-panel .chat-layout.admin-mobile-list-mode {
    height: calc(100dvh - 90px);
  }

  .admin-mobile-list-mode .chat-sidebar {
    position: relative;
    inset: auto;
    width: 100%;
    height: 100%;
    transform: none;
    border-right: 0;
    border-bottom: var(--border);
    box-shadow: none;
  }

  .admin-mobile-list-mode .chat-main {
    display: none;
  }

  .admin-mobile-list-mode .chat-backdrop {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Dropdown Menu */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background-color: var(--card-bg);
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.dropdown-content button {
  color: var(--text);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.dropdown-content button:hover {
  background-color: var(--hover-bg);
}

.dropdown-content button.text-danger {
  color: #ff4d4d;
}

.dropdown.show .dropdown-content {
  display: block;
  background-color: var(--card-bg);
}

/* Call Modal */
.call-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 20, 26, 0.95);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.call-modal-content {
  text-align: center;
  color: #fff;
  width: 100%;
  max-width: 400px;
}

.call-modal-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 0 auto 24px;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  overflow: hidden;
  box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4);
  border: 4px solid rgba(255, 255, 255, 0.05);
}

.call-modal-avatar.speaking {
  animation: pulseAvatar 1.5s infinite;
}

.call-modal-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-modal-name {
  margin: 0 0 8px;
  font-size: 1.8rem;
  font-weight: 600;
}

.call-modal-status {
  color: #25d366;
  font-size: 1.1rem;
  margin: 0 0 60px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.call-modal-actions {
  display: flex;
  justify-content: center;
}

.call-action-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #fff;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.call-action-btn:hover {
  transform: scale(1.1);
}

.call-action-btn:active {
  transform: scale(0.9);
}

.call-accept {
  background: #25d366;
  background: linear-gradient(135deg, #25d366, #128c7e);
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
}

.call-end {
  background: #ff4b2b;
  background: linear-gradient(135deg, #ff416c, #ff4b2b);
  box-shadow: 0 8px 24px rgba(255, 75, 43, 0.4);
}

.call-incoming-actions {
  gap: 48px;
}

.remote-video-el {
  width: 100%;
  max-height: 300px;
  background: #000;
  border-radius: 20px;
  margin-bottom: 24px;
  object-fit: cover;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.1);
  animation: slideIn 0.5s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseAvatar {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.3);
  }

  70% {
    box-shadow: 0 0 0 30px rgba(37, 211, 102, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(1.05);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.call-modal-overlay.closing {
  opacity: 0;
  transition: opacity 0.3s;
}