:root {
  --bg: #0b141a;
  --bg2: #111b21;
  --bg3: #202c33;
  --bg-hover: #2a3942;
  --border: #233138;
  --text: #e9edef;
  --muted: #8696a0;
  --accent: #00a884;
  --accent-dark: #008f72;
  --accent-light: rgba(0, 168, 132, 0.15);
  --danger: #ea0038;
  --own: #005c4b;
  --other: #202c33;
  --nav-bg: #1f2c34;
  --nav-active: rgba(0, 168, 132, 0.12);
  --radius: 8px;
  --header-bg: #202c33;
  --composer-bg: #202c33;
  --chat-bg-pattern: #0b141a;
  --bubble-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  --chat-active-bg: #2a3942;
  --msg-file-bg: rgba(0, 0, 0, 0.2);
  --msg-file-border: rgba(255, 255, 255, 0.06);
  --msg-meta-color: rgba(233, 237, 239, 0.55);
  --day-divider-bg: #182229;
  --day-divider-color: rgba(233, 237, 239, 0.75);
  --chat-wallpaper-opacity: 0.5;
  --unread-marker-bg: #3d2b1a;
  --unread-marker-color: #f5a623;
  --unread-marker-border: rgba(245, 166, 35, 0.4);
}

/* =============================================
   TEMA CHIARO (WhatsApp Web Light)
   ============================================= */
[data-theme="light"] {
  --bg: #efeae2;
  --bg2: #ffffff;
  --bg3: #f0f2f5;
  --bg-hover: #f5f6f6;
  --border: #e9edef;
  --text: #111b21;
  --muted: #667781;
  --accent: #00a884;
  --accent-dark: #008069;
  --accent-light: rgba(0, 168, 132, 0.12);
  --danger: #ea0038;
  --own: #d9fdd3;
  --other: #ffffff;
  --nav-bg: #f0f2f5;
  --nav-active: rgba(0, 168, 132, 0.15);
  --header-bg: #f0f2f5;
  --composer-bg: #f0f2f5;
  --chat-bg-pattern: #efeae2;
  --bubble-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  --chat-active-bg: #f0f2f5;
  --msg-file-bg: rgba(0, 0, 0, 0.04);
  --msg-file-border: rgba(0, 0, 0, 0.08);
  --msg-meta-color: #667781;
  --day-divider-bg: #ffffff;
  --day-divider-color: #54656f;
  --chat-wallpaper-opacity: 0.6;
  --unread-marker-bg: #fff8e6;
  --unread-marker-color: #b78103;
  --unread-marker-border: rgba(245, 166, 35, 0.3);
}

[data-theme="light"] #loginView {
  background: linear-gradient(180deg, #00a884 0%, #00a884 220px, #f0f2f5 220px);
}

[data-theme="light"] .login-card {
  box-shadow: 0 8px 32px rgba(11, 20, 26, 0.08);
}

[data-theme="light"] #main::before {
  background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='p' width='40' height='40' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='2' cy='2' r='1' fill='rgba(0,0,0,0.035)'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='200' height='200' fill='url(%23p)'/%3E%3C/svg%3E");
}

[data-theme="light"] .msg.own .msg-meta {
  color: #54656f;
}

[data-theme="light"] .msg.other .msg-meta {
  color: #667781;
}

[data-theme="light"] .msg-file a {
  color: #027eb5 !important;
}

[data-theme="light"] .file-name {
  color: #111b21;
}

[data-theme="light"] .file-link-btn {
  color: #027eb5;
}

[data-theme="light"] .file-link-btn:hover {
  background: rgba(2, 126, 181, 0.1);
}

[data-theme="light"] .search-input-wrap {
  background: #f0f2f5;
  border-color: #e9edef;
}

[data-theme="light"] .modal {
  background: rgba(11, 20, 26, 0.45);
}

[data-theme="light"] .modal-box {
  box-shadow: 0 12px 48px rgba(11, 20, 26, 0.2);
}
* {
  box-sizing: border-box;
}
/* IMPORTANTE: l'attributo hidden vale sempre, anche su elementi con display impostato */
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  overflow: hidden;
}
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.hidden {
  display: none !important;
}

/* ---------- login ---------- */
#loginView {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #00a884 0%, #00a884 200px, var(--bg) 200px);
}
#setupView {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #00a884 0%, #00a884 200px, var(--bg) 200px);
}
.login-card {
  width: 380px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.4);
}
.login-logo {
  font-size: 48px;
  margin-bottom: 8px;
}
.login-card h1 {
  margin: 8px 0 2px;
  font-size: 22px;
  color: var(--text);
}
.login-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 24px;
}
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card input,
.modal-box input,
.modal-box select,
.user-form input,
.user-form select {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.login-card input:focus,
.modal-box input:focus,
.user-form input:focus {
  border-color: var(--accent);
}
.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 4px;
}

/* =============================================
   LAYOUT — 3 COLONNE: nav-rail | sidebar | main
   ============================================= */
#mainView {
  display: flex;
  height: 100vh;
  width: 100vw;
  max-width: 100vw;
  overflow: hidden;
}

/* ---------- NAV RAIL (colonna icone, stile WA Web) ---------- */
#navRail {
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 0;
  z-index: 10;
}
.nav-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  overflow-y: auto;
  scrollbar-width: none;
  width: 100%;
}
.nav-top::-webkit-scrollbar {
  display: none;
}
.nav-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.nav-btn {
  width: 52px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 2px 3px;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
}
.nav-btn svg {
  transition: color 0.2s;
}
.nav-label {
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.01em;
  opacity: 0.85;
}
.nav-btn:hover {
  background: var(--bg3);
  color: var(--text);
}
.nav-btn.active {
  color: var(--accent);
  background: var(--nav-active);
}
.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

/* Nav user avatar */
.nav-user {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
}
.nav-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
.nav-user:hover .nav-user-avatar {
  border-color: var(--accent);
}

/* ---------- SIDEBAR (contatti + chat list) ---------- */
#sidebar {
  width: 520px;
  min-width: 300px;
  max-width: 560px;
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  height: 60px;
  background: var(--header-bg);
}
.brand {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
.head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Search input with icon */
.chat-filter-wrap {
  padding: 8px 12px;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  transition: border-color 0.15s;
}
.search-input-wrap:focus-within {
  border-color: var(--accent);
}
.search-input-icon {
  flex-shrink: 0;
  color: var(--muted);
  transition: color 0.2s;
}
.search-input-wrap:focus-within .search-input-icon {
  color: var(--accent);
}
.chat-filter {
  flex: 1;
  padding: 8px 4px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

/* Sidebar tabs (Tutte / Da leggere / Segna come lette) */
.sidebar-tabs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 4px 12px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.sidebar-tabs::-webkit-scrollbar {
  display: none;
}
.sidebar-tab {
  padding: 5px 10px;
  border-radius: 18px;
  border: none;
  background: var(--bg3);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}
.sidebar-tab:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.sidebar-tab.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* Section title */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 6px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.btn-add-account {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg3);
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.btn-add-account:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.empty-accounts-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 14px;
  gap: 8px;
  background: var(--bg3);
  border: 1px dashed var(--border);
  border-radius: 10px;
  margin: 8px;
}
.empty-accounts-box .empty-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.empty-accounts-box .empty-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 6px;
}
.btn-add-empty {
  font-size: 12.5px;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
}

/* Account list */
.account-list {
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s;
}
.account-item:hover {
  background: var(--bg-hover);
}
.account-item.active {
  background: var(--bg3);
  border-color: var(--border);
}
.account-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 13px;
}
.account-info {
  flex: 1;
  min-width: 0;
}
.account-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-meta {
  font-size: 11px;
  color: var(--muted);
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-connected {
  background: var(--accent);
}
.status-connecting {
  background: #f5a623;
  animation: pulse 1.2s infinite;
}
.status-disconnected,
.status-auth_failure {
  background: var(--danger);
}
.status-qr {
  background: #f5a623;
}
@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}
.account-actions {
  display: flex;
  gap: 4px;
}

/* Chat list */
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.chat-item:hover {
  background: var(--bg-hover);
}
.chat-item.active {
  background: var(--chat-active-bg, #2a3942);
}
.chat-ava {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}
.chat-ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.chat-info {
  flex: 1;
  min-width: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* Remove bottom border from the chat-info when inside the last item */
.chat-item:last-child .chat-info {
  border-bottom: none;
}
.chat-name-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.chat-name {
  font-weight: 500;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.channel-mini-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(83, 189, 235, 0.15);
  color: #53bdeb;
  margin-left: 6px;
  vertical-align: middle;
}
.chat-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-preview {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.chat-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
  flex-shrink: 0;
  min-height: 38px;
}
.chat-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.chat-meta {
  display: flex;
  align-items: center;
  gap: 5px;
}
.chat-pin-icon {
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
}
.unread-badge {
  background: #25d366;
  color: #ffffff;
  font-weight: 600;
  font-size: 11px;
  min-width: 19px;
  height: 19px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
}

.unread-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #25d366;
  box-shadow: 0 0 0 3px var(--bg1, #0b141a);
  flex-shrink: 0;
}

.chat-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transform: translateX(3px);
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.12s ease, color 0.12s ease;
}
.chat-item:hover .chat-dropdown-toggle,
.chat-item.menu-open .chat-dropdown-toggle {
  opacity: 1;
  transform: translateX(0);
}
.chat-dropdown-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}
[data-theme="light"] .chat-dropdown-toggle:hover {
  background: rgba(0, 0, 0, 0.08);
}

.unread-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 4px;
  border-radius: 999px;
  background: #25d366;
  color: #06281a;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.sidebar-tab.active .unread-tab-count {
  background: #fff;
  color: var(--accent);
}
.mark-all-read {
  margin-left: auto;
  color: var(--accent);
  font-weight: 600;
}
.mark-all-read:hover {
  background: rgba(37, 211, 102, 0.15);
  color: #25d366;
}

/* ---------- MAIN AREA ---------- */
#main {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--chat-bg-pattern);
  position: relative;
  overflow: hidden;
  height: 100vh;
}
/* Chat wallpaper pattern overlay */
#main::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='p' width='40' height='40' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='2' cy='2' r='1' fill='rgba(255,255,255,0.015)'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='200' height='200' fill='url(%23p)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: var(--chat-wallpaper-opacity, 0.5);
}

/* Chat header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  min-height: 60px;
  z-index: 2;
  min-width: 0;
  flex-shrink: 0;
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
}
.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.chat-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.chat-title {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-account {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Badges */
.badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg3);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge.on {
  background: rgba(0, 168, 132, 0.15);
  color: var(--accent);
  border-color: var(--accent);
}
.badge-lid {
  background: rgba(245, 166, 35, 0.15) !important;
  color: #f5a623 !important;
  border-color: #f5a623 !important;
  font-size: 10.5px !important;
  padding: 2px 8px !important;
}
.badge-channel {
  background: rgba(83, 189, 235, 0.15) !important;
  color: #53bdeb !important;
  border-color: #53bdeb !important;
  font-size: 10.5px !important;
  padding: 2px 8px !important;
}
.badge-group {
  background: rgba(0, 168, 132, 0.15) !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
  font-size: 10.5px !important;
  padding: 2px 8px !important;
}

/* Messages area */
.messages {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 1;
}
.messages .empty {
  align-self: center;
  color: var(--muted);
  margin-top: 40px;
}
.msg {
  max-width: min(72%, 520px);
  padding: 6px 9px 8px 10px;
  border-radius: 8px;
  position: relative;
  word-wrap: break-word;
  box-shadow: var(--bubble-shadow);
  box-sizing: border-box;
}
.msg.own {
  align-self: flex-end;
  background: var(--own);
  border-top-right-radius: 0;
}
.msg.other {
  align-self: flex-start;
  background: var(--other);
  border-top-left-radius: 0;
}
.msg-body {
  white-space: pre-wrap;
  line-height: 1.35;
  font-size: 14.2px;
}
.msg-media {
  max-width: 100%;
  max-height: 330px;
  width: auto;
  height: auto;
  border-radius: 6px;
  margin-bottom: 4px;
  display: block;
  cursor: pointer;
  object-fit: contain;
}
.msg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--msg-file-bg, rgba(0, 0, 0, 0.2));
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 13px;
  border: 1px solid var(--msg-file-border, rgba(255, 255, 255, 0.06));
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.msg-file a {
  color: #53bdeb !important;
  text-decoration: none;
  font-weight: 600;
  word-break: break-all;
}
.msg-file a:hover {
  text-decoration: underline;
  color: #7cd6f5 !important;
}
.msg-file-missing {
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
  border-style: dashed;
}
.file-icon {
  font-size: 26px;
  flex-shrink: 0;
}
.file-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.file-name {
  font-weight: 600;
  font-size: 13px;
  word-break: break-all;
  color: var(--text);
}
.file-link-btn {
  background: none;
  border: none;
  color: #53bdeb;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
}
.file-link-btn:hover {
  background: rgba(83, 189, 235, 0.15);
  text-decoration: underline;
}
.file-preview {
  width: 100%;
  max-height: 340px;
  border-radius: 8px;
  background: #fff;
  margin-top: 6px;
  flex: none;
}
.msg-meta {
  text-align: right;
  font-size: 11px;
  color: var(--msg-meta-color, rgba(233, 237, 239, 0.55));
  margin-top: 2px;
  padding-left: 10px;
  float: right;
  position: relative;
  top: 4px;
}
.msg.own .msg-meta::after {
  content: " ✓✓";
}
.day-divider {
  align-self: center;
  background: var(--day-divider-bg, #182229);
  color: var(--day-divider-color, rgba(233, 237, 239, 0.75));
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 8px;
  margin: 10px 0;
  box-shadow: var(--bubble-shadow);
}

/* ---------- composer ---------- */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 16px 10px;
  background: var(--composer-bg);
  border-top: 1px solid var(--border);
  z-index: 2;
  flex-shrink: 0;
  min-width: 0;
  box-sizing: border-box;
}
.attach {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 50%;
  transition: all 0.15s;
  flex-shrink: 0;
}
.attach:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.attach svg {
  transition: transform 0.2s;
}
.attach:hover svg {
  transform: rotate(-20deg);
}
.composer-input-wrap {
  flex: 1 1 0%;
  min-width: 0;
}
#msgInput {
  width: 100%;
  resize: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  max-height: 140px;
  overflow-y: auto;
  transition: border-color 0.15s;
}
#msgInput:focus {
  border-color: var(--accent);
}
.btn-send {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-send:hover {
  color: var(--text);
  background: var(--bg-hover);
}

/* ---------- bottoni ---------- */
.btn {
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}
.btn:hover {
  background: var(--bg-hover);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
.btn-primary:hover {
  background: var(--accent-dark);
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-small {
  padding: 3px 10px;
  font-size: 12px;
}
.btn-icon {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.btn-icon.danger:hover {
  color: var(--danger);
}

/* Chip */
.chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  width: 380px;
  max-width: 92vw;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}
.modal-box h2 {
  margin: 0 0 6px;
  font-size: 18px;
}
.modal-sub {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  margin: 0 0 14px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.qr-canvas {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}
.qr-canvas img {
  width: 260px;
  height: 260px;
  image-rendering: pixelated;
}
.qr-box {
  width: 360px;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ddd;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- utenti ---------- */
.users-box {
  width: 420px;
  max-height: 80vh;
  overflow-y: auto;
}
.user-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.user-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg3);
  border-radius: 8px;
}
.user-list .role {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}
.user-list .u-me {
  background: var(--bg3);
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  max-width: 80vw;
  font-size: 13px;
}
.toast.success {
  border-color: var(--accent);
}
.toast.error {
  border-color: var(--danger);
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 20px;
  font-size: 13px;
}
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

.media-attach {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 2px 0;
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- rubrica & contatti ---------- */
.contacts-box {
  width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.modal-header-row h2 {
  margin: 0;
  font-size: 18px;
}
.modal-actions-top {
  display: flex;
  gap: 6px;
}
.contact-search-bar {
  margin-bottom: 10px;
}
.contact-search-bar input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.contact-search-bar input:focus {
  border-color: var(--accent);
}
.contact-form {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.contact-form h3 {
  margin: 0 0 4px;
  font-size: 14px;
}
.contact-form input {
  padding: 8px 10px;
  font-size: 13px;
}
.form-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.contacts-list {
  flex: 1;
  overflow-y: auto;
  max-height: 380px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}
.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg3);
  border-radius: 8px;
  border: 1px solid transparent;
}
.contact-item:hover {
  border-color: var(--border);
}
.contact-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2a3d4f;
  color: #53bdeb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.contact-info {
  flex: 1;
  min-width: 0;
}
.contact-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-sub {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.contact-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ---------- CSV modal ---------- */
.csv-box {
  width: 520px;
  max-height: 85vh;
}
.csv-upload-zone {
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.csv-file-name {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}
.csv-paste-zone {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.csv-paste-zone label {
  font-size: 12px;
  color: var(--muted);
}
.csv-paste-zone textarea {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: Consolas, monospace;
  font-size: 12px;
  resize: vertical;
  outline: none;
}
.csv-paste-zone textarea:focus {
  border-color: var(--accent);
}
.csv-preview {
  background: rgba(0, 168, 132, 0.1);
  border: 1px solid rgba(0, 168, 132, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 12px;
}
.btn-file {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

/* ---------- azioni chat & numero nascosto ---------- */
.form-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.input-readonly {
  background: #141a21 !important;
  color: var(--muted) !important;
  cursor: not-allowed;
}

/* ---------- anteprima media (lightbox) ---------- */
.preview-box {
  width: min(92vw, 860px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.preview-box h2 {
  margin: 0 0 8px;
  font-size: 17px;
  word-break: break-all;
}
.preview-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  max-height: 72vh;
  background: var(--bg3);
  border-radius: 8px;
  padding: 12px;
  box-sizing: border-box;
}
.preview-img,
.preview-media {
  max-width: 100%;
  max-height: 68vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}
.preview-obj {
  width: 100%;
  height: 68vh;
  border-radius: 8px;
  background: #fff;
}
.preview-info {
  color: var(--muted);
  font-size: 14px;
  word-break: break-all;
}
.msg-media.previewable {
  cursor: zoom-in;
}
.tile-zoom {
  cursor: pointer;
}
.sync-hint {
  font-style: italic;
}

/* ---------- chat fissate / segnaposto lettura / ricerca ---------- */
.pin-mark {
  font-size: 12px;
  color: var(--accent);
}
.unread-marker {
  align-self: center;
  background: var(--unread-marker-bg, #3d2b1a);
  color: var(--unread-marker-color, #f5a623);
  border: 1px solid var(--unread-marker-border, rgba(245, 166, 35, 0.4));
  font-size: 11px;
  padding: 3px 12px;
  border-radius: 999px;
  margin: 8px 0;
}
.search-box {
  width: 520px;
  max-width: 94vw;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}
.search-box input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.search-box input:focus {
  border-color: var(--accent);
}
.search-results {
  flex: 1;
  overflow-y: auto;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  cursor: pointer;
}
.search-result:hover {
  background: var(--bg-hover);
}
.search-result-main {
  flex: 1;
  min-width: 0;
}
.search-result-main strong {
  font-size: 13px;
  color: var(--text);
}
.search-result-preview {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-time {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

/* ---------- banner sincronizzazione ---------- */
.sync-banner {
  position: sticky;
  top: 0;
  width: 100%;
  box-sizing: border-box;
  background: rgba(245, 166, 35, 0.12);
  border-bottom: 1px solid rgba(245, 166, 35, 0.4);
  color: #f5a623;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.sync-banner[hidden] {
  display: none !important;
}
.sync-banner.done {
  background: rgba(0, 168, 132, 0.12);
  border-color: rgba(0, 168, 132, 0.4);
  color: var(--accent);
}
.sync-banner-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.sync-dismiss {
  background: none;
  border: none;
  color: inherit;
  font-size: 15px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.75;
  transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.sync-dismiss:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}
.sync-btn-details {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 12px;
  cursor: pointer;
  margin: 0 6px;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.sync-btn-details:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.35);
}

/* ---------- Modale Sincronizzazione ---------- */
.sync-modal-box {
  width: 540px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.sync-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0 16px;
}
.sync-metric-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.sync-metric-icon {
  font-size: 22px;
}
.sync-metric-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-family: Consolas, monospace;
}
.sync-metric-label {
  font-size: 11px;
  color: var(--muted);
}
.sync-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.sync-status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f5a623;
  animation: pulse 1.2s infinite;
  flex-shrink: 0;
}
.sync-status-indicator.done {
  background: var(--accent);
  animation: none;
}
.sync-progress-bar-wrap {
  height: 8px;
  background: var(--bg3);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.sync-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
}
.sync-events-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}
.sync-last-time {
  font-size: 11px;
  color: var(--muted);
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
}
.sync-events-list {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.sync-event-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--text);
  line-height: 1.4;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 4px;
}
.sync-event-item:last-child {
  border-bottom: none;
}
.sync-event-time {
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 11px;
  flex-shrink: 0;
}

/* ---------- toggle chat vuote ---------- */
.toggle-empty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.toggle-empty input {
  accent-color: var(--accent);
}

/* ---------- Messaggi di Gruppo & Avatar Mittenti ---------- */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: min(82%, 580px);
  position: relative;
  box-sizing: border-box;
}
.msg-row.own-row {
  align-self: flex-end;
  justify-content: flex-end;
}
.msg-row.other-row {
  align-self: flex-start;
  justify-content: flex-start;
}
.msg-row.group-incoming {
  align-self: flex-start;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.msg-sender-ava {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  overflow: hidden;
  margin-top: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.msg-sender-ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.msg-sender-name {
  font-size: 12.8px;
  font-weight: 700;
  margin-bottom: 3px;
  cursor: pointer;
  line-height: 1.2;
}
.msg-mention {
  color: #53bdeb;
  font-weight: 600;
  background: rgba(83, 189, 235, 0.12);
  padding: 1px 4px;
  border-radius: 4px;
  display: inline-block;
}

/* ---------- Lettore Note Vocali WhatsApp ---------- */
.vn-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
  min-width: 260px;
  max-width: 330px;
  user-select: none;
}
.vn-btn-play {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent, #00a884);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s, background 0.15s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.vn-btn-play:hover {
  transform: scale(1.05);
  background: #02906f;
}
.vn-btn-play .vn-icon {
  font-size: 14px;
  line-height: 1;
  margin-left: 2px;
}
.vn-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.vn-track {
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.vn-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  height: 22px;
}
.vn-bar {
  flex: 1;
  background: var(--muted, #8696a0);
  border-radius: 2px;
  min-height: 3px;
  transition: background 0.12s;
}
.vn-bar.active {
  background: var(--accent, #00a884);
}
.vn-prog-fill {
  position: absolute;
  left: 0;
  top: 50%;
  height: 2px;
  background: var(--accent, #00a884);
  pointer-events: none;
  opacity: 0;
}
.vn-scrubber {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent, #00a884);
  left: 0%;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.vn-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted, #8696a0);
}
.vn-speed-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text, #e9edef);
  border-radius: 10px;
  font-size: 10px;
  padding: 1px 6px;
  cursor: pointer;
  font-weight: 600;
}
.vn-speed-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}
.vn-sender-badge {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}
.vn-mini-ava {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 14px;
}
.vn-mic-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  font-size: 11px;
  background: var(--accent, #00a884);
  border-radius: 50%;
  width: 17px;
  height: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--other, #202c33);
}
.vn-missing-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
  min-width: 220px;
}
.vn-missing-icon {
  font-size: 22px;
  opacity: 0.85;
}
.vn-missing-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.vn-missing-title {
  font-size: 13px;
  font-weight: 600;
}
.vn-missing-sub {
  font-size: 11px;
  color: var(--muted);
}

/* =============================================
   MENU CONTESTUALE CHAT (WhatsApp Web Style)
   ============================================= */
.wa-context-menu {
  position: fixed;
  z-index: 99999;
  min-width: 220px;
  max-width: 270px;
  background: #233138;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 0;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  animation: waContextPop 0.12s cubic-bezier(0.1, 0.9, 0.2, 1);
  user-select: none;
}

[data-theme="light"] .wa-context-menu {
  background: #ffffff;
  border: 1px solid #e9edef;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

@keyframes waContextPop {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.wa-context-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 18px;
  font-size: 14px;
  color: var(--text, #e9edef);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  box-sizing: border-box;
  font-family: inherit;
  transition: background 0.1s ease;
}

.wa-context-item:hover {
  background: #182229;
}

[data-theme="light"] .wa-context-item {
  color: #111b21;
}

[data-theme="light"] .wa-context-item:hover {
  background: #f0f2f5;
}

.wa-context-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--muted, #8696a0);
  flex-shrink: 0;
}

.wa-context-item:hover .wa-context-icon {
  color: var(--text, #e9edef);
}

[data-theme="light"] .wa-context-item:hover .wa-context-icon {
  color: #111b21;
}

.wa-context-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 400;
}

.wa-context-arrow {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted, #8696a0);
  padding-left: 8px;
}

.wa-context-item.danger {
  color: var(--danger, #ea0038);
}

.wa-context-item.danger .wa-context-icon {
  color: var(--danger, #ea0038);
}

.wa-context-item.danger:hover {
  background: rgba(234, 0, 56, 0.12);
}

