/* Sposta selectors-container a destra nella navbar */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow: visible;
}
.nav-left {
  display: flex;
  align-items: center;
  overflow: visible;
}
.selectors-container {
  margin-left: 0;
  display: flex;
  align-items: center;
  gap: 0; /* remove space between workspace and channel */
  position: relative;
  z-index: 100;
  overflow: visible;
}

.selectors-container > div,
.selectors-container > button {
  position: relative;
}

/* Keep channel selector snug to workspace button */
.channel-selector {
  display: flex;
  align-items: center;
  position: relative;
  margin-left: 4px; /* minimal offset from workspace button */
}
/* ===================================
   chatlify - Component Styles
   =================================== */

/* ===================================
   Modal
   =================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

.modal {
  background: var(--card-bg);
  border-radius: 1.25rem;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.18), 0 12px 24px rgba(0, 0, 0, 0.12);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(60px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  width: 44px;
  height: 44px;
  border-radius: 0.625rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.modal-close:hover {
  background: var(--border-color);
  color: var(--text-primary);
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.modal-close:active {
  transform: rotate(90deg) scale(0.95);
}

/* Enhanced form styles for email configuration modal */
.form-error {
  color: #e74c3c;
  font-size: 0.85rem;
  margin-top: 4px;
  display: block;
}

.form-control.is-invalid {
  border-color: #e74c3c;
  background-color: #fff5f5;
}

.form-control:focus {
  border-color: #3498db;
  box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

fieldset legend {
  display: flex;
  align-items: center;
  gap: 8px;
}

.password-toggle {
  transition: all 0.2s;
}

.password-toggle:hover {
  background: #f0f0f0 !important;
  color: #3498db !important;
}

/* Responsive grid for form rows */
@media (max-width: 600px) {
  [style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  
  .form-actions {
    flex-direction: column !important;
  }
}

.modal-body {
  padding: var(--spacing-lg);
  max-height: calc(90vh - 150px);
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-footer {
  padding: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm);
}

/* ===================================
   Tree View (Folders)
   =================================== */

.tree-view {
  list-style: none;
  padding-left: 0;
}

.tree-item {
  margin: var(--spacing-xs) 0;
}

.tree-item-content {
  display: flex;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
  border: 1px solid transparent;
}

.tree-item-content:hover {
  background: var(--bg-tertiary);
  transform: translateX(4px);
  border-color: rgba(99, 102, 241, 0.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.tree-item-content:active {
  transform: translateX(2px) scale(0.98);
}

.tree-item-content.active {
  background: var(--primary-light);
  color: var(--white);
}

.tree-toggle {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: var(--spacing-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.tree-toggle:hover {
  background: var(--border-color);
  transform: scale(1.2) rotate(5deg);
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.15);
}

.tree-toggle i {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.tree-item.expanded > .tree-item-content .tree-toggle i {
  transform: rotate(90deg);
}

/* Tree Toggle Spacer - per allineare item senza figli */
.tree-toggle-spacer {
  width: 20px;
  height: 20px;
  display: inline-block;
  margin-right: var(--spacing-sm);
  flex-shrink: 0;
}

.tree-icon {
  width: 20px;
  margin-right: var(--spacing-sm);
  color: var(--primary);
  flex-shrink: 0;
}

.tree-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tree Badge - contatore canali */
.tree-badge {
  background: var(--primary-light);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  margin-left: 8px;
  flex-shrink: 0;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.tree-item-content:hover .tree-badge {
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.tree-actions {
  display: none;
  gap: var(--spacing-xs);
  margin-left: var(--spacing-sm);
  flex-shrink: 0;
}

.tree-item-content:hover .tree-actions {
  display: flex;
}

.tree-action-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  cursor: pointer;
}

.tree-action-btn:hover {
  background: var(--border-color);
  color: var(--primary);
  transform: scale(1.15) rotate(5deg);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.tree-action-btn:active {
  transform: scale(0.95);
}

.tree-children {
  padding-left: 1.5rem;
  display: none;
  border-left: 2px solid var(--border-color);
  margin-left: 10px;
  margin-top: 4px;
}

.tree-item.expanded > .tree-children {
  display: block;
}

/* Tree Item States - has-children indica cartelle con figli */
.tree-item.has-children > .tree-item-content {
  font-weight: 500;
}

/* Livelli di profondità - styling progressivo */
.tree-item[data-level="0"] > .tree-item-content {
  font-weight: 600;
}

.tree-item[data-level="1"] > .tree-item-content {
  font-size: 0.95rem;
}

.tree-item[data-level="2"] > .tree-item-content {
  font-size: 0.9rem;
  opacity: 0.95;
}

.tree-item[data-level="3"] > .tree-item-content,
.tree-item[data-level="4"] > .tree-item-content,
.tree-item[data-level="5"] > .tree-item-content {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* ===================================
   Drag & Drop States
   =================================== */

.sortable-ghost {
  opacity: 0.4;
  background: var(--primary-light) !important;
}

.sortable-drag {
  opacity: 1 !important;
  cursor: move !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tree-item.dragging {
  opacity: 0.5;
}

.tree-item.drag-over {
  background: var(--primary-light);
  border-radius: var(--radius-md);
}

/* Visual feedback durante drag */
.tree-item-content.sortable-chosen {
  background: var(--primary-light) !important;
  color: var(--white);
}

.tree-item-content.sortable-ghost {
  background: rgba(99, 102, 241, 0.2) !important;
  border: 2px dashed var(--primary);
}

/* ===================================
   Channel Cards
   =================================== */

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-lg);
}

.channel-card {
  background: var(--card-bg);
  border-radius: 0.875rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  padding: 1rem;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 1px solid var(--border-color);
}

.channel-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.08);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-4px) scale(1.02);
}

.channel-card:active {
  transform: translateY(-2px) scale(0.98);
}

.channel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.channel-header-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.875rem;
}

.btn-icon-sm:hover {
  background: var(--danger);
  color: white;
  transform: scale(1.15) rotate(5deg);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-icon-sm:active {
  transform: scale(0.95);
}

.channel-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.channel-icon.clickable {
  cursor: pointer;
  position: relative;
}

.channel-icon.clickable:hover {
  transform: scale(1.15) rotate(5deg);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

.channel-icon.clickable:active {
  transform: scale(1.05) rotate(2deg);
}

.channel-icon.whatsapp {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: var(--white);
}

.channel-icon.email {
  background: linear-gradient(135deg, #ea4335 0%, #c5221f 100%);
  color: var(--white);
}

.channel-icon.telegram {
  background: linear-gradient(135deg, #0088cc 0%, #005f8d 100%);
  color: var(--white);
}

.channel-icon.twitter {
  background: linear-gradient(135deg, #1da1f2 0%, #0c85d0 100%);
  color: var(--white);
}

/* Channel Notification Badge */
.channel-notification-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  animation: badgePulse 2s ease-in-out infinite;
  z-index: 10;
  pointer-events: none;
  white-space: nowrap;
  max-width: 80px;
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.6);
  }
}

.channel-notification-badge.high-count {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  animation: badgePulseHigh 1.5s ease-in-out infinite;
}

@keyframes badgePulseHigh {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.channel-status {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--white);
}

.channel-status.active {
  background: var(--success);
}

.channel-status.inactive {
  background: var(--gray-400);
}

.channel-status.error {
  background: var(--danger);
}

.channel-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.channel-info p {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  line-height: 1.4;
  margin: 0;
}

.channel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.channel-labels {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

/* ===================================
   Label Tag
   =================================== */

.label-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: default;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.label-tag:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.label-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ===================================
   Color Picker
   =================================== */

.color-picker {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.color-option {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.color-option:hover {
  transform: scale(1.2) rotate(5deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.color-option:active {
  transform: scale(1.05);
}

.color-option.selected {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--white), 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: scale(1.15);
}

/* ===================================
   Stats Grid
   =================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-color);
}

.stat-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.3);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.stat-card:hover .stat-icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.stat-icon.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
}

.stat-icon.success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: var(--white);
}

.stat-icon.warning {
  background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
  color: var(--white);
}

.stat-icon.info {
  background: linear-gradient(135deg, var(--info) 0%, #2563eb 100%);
  color: var(--white);
}

.stat-info h4 {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin-bottom: var(--spacing-xs);
}

.stat-info .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ===================================
   Timeline
   =================================== */

.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--spacing-lg);
}

.timeline-marker {
  position: absolute;
  left: -1.5rem;
  top: 0.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--white);
  box-shadow: 0 0 0 2px var(--primary);
  background: var(--primary);
}

.timeline-marker.success {
  box-shadow: 0 0 0 2px var(--success);
  background: var(--success);
}

.timeline-marker.warning {
  box-shadow: 0 0 0 2px var(--warning);
  background: var(--warning);
}

.timeline-marker.error {
  box-shadow: 0 0 0 2px var(--danger);
  background: var(--danger);
}

.timeline-content {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.timeline-content:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.2);
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-sm);
}

.timeline-title {
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.timeline-body {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ===================================
   Filter Bar
   =================================== */

.filter-bar {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
  align-items: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.3s ease;
  border: 1px solid var(--border-color);
}

.filter-bar:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.filter-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.filter-group select,
.filter-group input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-group select:focus,
.filter-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), 0 2px 8px rgba(0, 0, 0, 0.08);
  outline: none;
  transform: translateY(-1px);
}

.filter-group select:hover,
.filter-group input:hover {
  border-color: var(--gray-400);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* ===================================
   Empty State
   =================================== */

.empty-state {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-tertiary);
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: var(--spacing-lg);
  color: var(--text-secondary);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  color: var(--text-primary);
}

.empty-state p {
  margin-bottom: var(--spacing-lg);
}

/* ===================================
   Team Members
   =================================== */

.team-members {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.team-member {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.team-member:hover {
  background: var(--bg-secondary);
}

.member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.member-info {
  flex: 1;
}

.member-name {
  font-weight: 600;
  color: var(--text-primary);
}

.member-email {
  font-size: 0.875rem;
  color: var(--text-tertiary);
}

.member-role {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ===================================
   Breadcrumb
   =================================== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 600;
}

.breadcrumb-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.breadcrumb-link:hover {
  color: var(--primary);
  background: var(--bg-tertiary);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.breadcrumb-separator {
  color: var(--gray-400);
  font-size: 0.75rem;
}

/* ===================================
   Permission Matrix
   =================================== */

.permission-matrix {
  overflow-x: auto;
}

.permission-matrix table {
  min-width: 600px;
}

.permission-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ===================================
   Drag & Drop
   =================================== */

.draggable {
  cursor: move;
}

.dragging {
  opacity: 0.5;
}

.drop-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  text-align: center;
  color: var(--text-tertiary);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-secondary);
}

.drop-zone:hover {
  border-color: var(--gray-400);
  background: var(--bg-tertiary);
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
  animation: dragPulse 1s ease-in-out infinite;
}

@keyframes dragPulse {
  0%, 100% {
    border-color: var(--primary);
  }
  50% {
    border-color: rgba(99, 102, 241, 0.5);
  }
}

/* ===================================
   Channel Actions
   =================================== */

.channel-actions {
  display: flex;
  gap: var(--spacing-xs);
  align-items: center;
}

/* ===================================
   Chat Panel (WhatsApp Integration)
   =================================== */

.chat-panel {
  position: fixed;
  top: 60px;
  right: -420px;
  width: 420px;
  height: calc(100vh - 60px);
  background: #f7f9fa;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  border-radius: 18px 0 0 18px;
  transition: right 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(10px);
}

.chat-panel.open {
  right: 0;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.18);
}

.chat-panel.email-panel {
  width: min(1200px, calc(100vw - 80px));
  right: -100vw;
  border-radius: 18px 0 0 18px;
  background: var(--bg-primary);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.12);
}

.chat-panel.email-panel.open {
  right: 0;
  box-shadow: 0 12px 64px rgba(0, 0, 0, 0.2);
}

.email-panel-3col {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.4fr) minmax(260px, 0.9fr);
  height: 100%;
  background: var(--bg-secondary);
}

.email-panel-conversations,
.email-panel-thread,
.email-panel-details {
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.email-panel-conversations {
  border-right: 1px solid var(--border-color);
}

.email-panel-thread {
  border-right: 1px solid var(--border-color);
}

.email-panel-conversations .email-chat-list,
.email-panel-thread .tg-messages,
.email-panel-details .email-details-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md);
}

.email-panel-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.email-panel-details {
  padding: var(--spacing-md);
}

.email-panel-details .empty-state,
.email-panel-thread .empty-state {
  margin-top: 4rem;
}

.email-thread-actions {
  border-top: 1px solid var(--border-color);
  padding: var(--spacing-md);
  background: var(--bg-primary);
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm);
}

.chat-header {
  padding: var(--spacing-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
}

.chat-details h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.chat-details p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
}

.chat-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}

.chat-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 18px 18px 18px;
  background: #f4f6f8;
  border-radius: 0 0 0 18px;
}

.chat-message {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.chat-message.outgoing {
  flex-direction: row-reverse;
}

.chat-message-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e3e6ea;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.8rem;
  color: #b0b4b9;
}

.chat-message-content {
  max-width: 70%;
}

.chat-message-bubble {
  background: #fff;
  border-radius: 16px;
  padding: 10px 16px;
  box-shadow: 0 1px 4px #0001;
  border: 1px solid #f0f1f3;
}

.chat-message.outgoing .chat-message-bubble {
  background: #e7fbe9;
  color: #222;
  border: 1px solid #d2f5d6;
}

.chat-message-text {
  font-size: 1rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message-time {
  font-size: 0.72rem;
  color: #b0b4b9;
  margin-top: 2px;
  text-align: right;
}

.chat-input-container {
  padding: 14px 18px;
  background: #fff;
  border-top: 1px solid #e3e6ea;
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid #e3e6ea;
  border-radius: 18px;
  background: #f7f9fa;
  color: #222;
  outline: none;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: #25d366;
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #25d366;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.2s, transform 0.2s;
}

.chat-send-btn:hover {
  background: #128c7e;
  transform: scale(1.05);
}

.chat-send-btn:disabled {
  background: var(--gray-400);
  cursor: not-allowed;
  transform: none;
}

.chat-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
  color: var(--text-secondary);
  text-align: center;
  gap: var(--spacing-md);
  animation: fadeIn 0.4s ease;
}

.chat-loading .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--gray-300);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* QR Code Container */
.qr-code-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
  text-align: center;
  gap: var(--spacing-lg);
  animation: fadeInScale 0.5s ease;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.qr-code-header h3 {
  margin: var(--spacing-md) 0 var(--spacing-sm);
  color: var(--text-primary);
  font-size: var(--font-lg);
}

.qr-code-header p {
  color: var(--text-secondary);
  font-size: var(--font-sm);
}

.qr-code-image {
  background: white;
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid var(--border-color);
}

.qr-code-image:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: scale(1.05);
  border-color: rgba(99, 102, 241, 0.3);
}

.qr-code-image img {
  display: block;
  width: 250px;
  height: 250px;
  border-radius: var(--radius-md);
  transition: transform 0.3s ease;
}

.qr-code-image:hover img {
  transform: rotate(2deg);
}

.qr-code-instructions {
  max-width: 400px;
  text-align: left;
  background: var(--background);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.qr-code-instructions ol {
  margin: 0;
  padding-left: var(--spacing-lg);
  color: var(--text-secondary);
  font-size: var(--font-sm);
}

.qr-code-instructions li {
  margin: var(--spacing-xs) 0;
}

.qr-code-instructions strong {
  color: var(--text-primary);
  font-weight: 600;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xxl);
  color: var(--text-secondary);
  text-align: center;
  gap: var(--spacing-sm);
}

.chat-empty i {
  font-size: 64px;
  color: var(--gray-400);
  margin-bottom: var(--spacing-md);
}

.chat-empty p {
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.chat-empty small {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

/* ===================================
   Template Cards (Permissions)
   =================================== */
.template-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.template-card {
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  background: var(--card-bg);
  cursor: pointer;
}

.template-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(66, 153, 225, 0.15);
  transform: translateY(-2px);
}

.template-card.selected {
  border-color: var(--primary);
  background: rgba(66, 153, 225, 0.08);
  box-shadow: 0 4px 16px rgba(66, 153, 225, 0.2);
}

.template-card.selected::after {
  content: '\f058';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 1.1rem;
  color: var(--primary);
}

.template-card {
  position: relative;
}

.template-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.template-header i {
  font-size: 1.5rem;
  color: var(--primary);
}

.template-header h4 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.template-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.template-permissions {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.template-permissions li {
  padding: 0.4rem 0;
  font-size: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.template-permissions li i {
  margin-top: 0.2rem;
}

.template-card button {
  width: 100%;
  margin-top: 1rem;
}

/* ===================================
   Channel Type Radio Buttons
   =================================== */

.channel-type-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.channel-type-option {
  position: relative;
}

.channel-type-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.channel-type-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--card-bg);
  min-height: 140px;
}

.channel-type-label:hover {
  border-color: var(--primary);
  background: rgba(66, 153, 225, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.channel-type-option input[type="radio"]:checked + .channel-type-label {
  border-color: var(--primary);
  background: rgba(66, 153, 225, 0.1);
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

.channel-type-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 0.75rem auto;
  font-size: 1.8rem;
  color: white;
  transition: transform 0.3s ease;
  box-sizing: border-box;
  overflow: hidden;
}

.channel-type-icon i {
  display: block;
  line-height: 1;
  text-align: center;
}

.channel-type-option:hover .channel-type-icon {
  transform: scale(1.1);
}

.channel-type-icon.whatsapp {
  background: linear-gradient(135deg, #25D366, #128C7E);
}

.channel-type-icon.email {
  background: linear-gradient(135deg, #EA4335, #C5221F);
}

.channel-type-icon.telegram {
  background: linear-gradient(135deg, #0088cc, #0077b5);
}

.channel-type-icon.messenger {
  background: linear-gradient(135deg, #0084FF, #00C6FF);
}

.channel-type-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  text-align: center;
}

.channel-type-status {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
}

.channel-type-option input[type="radio"]:disabled + .channel-type-label {
  opacity: 0.5;
  cursor: not-allowed;
}

.channel-type-option input[type="radio"]:disabled + .channel-type-label:hover {
  transform: none;
  border-color: var(--border-color);
  background: var(--card-bg);
  box-shadow: none;
}

/* Dark mode adjustments */
[data-theme="dark"] .channel-type-label {
  background: var(--bg-secondary);
}

[data-theme="dark"] .channel-type-label:hover {
  background: rgba(66, 153, 225, 0.1);
}

[data-theme="dark"] .channel-type-option input[type="radio"]:checked + .channel-type-label {
  background: rgba(66, 153, 225, 0.15);
}

/* ===================================
   Email Provider Choice (Mailer)
   Styled to match channel creation
   =================================== */

.email-provider-choice {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.provider-lead {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.email-provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.email-provider-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.95rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  transition: all 0.25s ease;
  text-align: left;
  width: 100%;
  cursor: pointer;
}

.email-provider-card:hover {
  border-color: var(--primary);
  background: rgba(66, 153, 225, 0.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.email-provider-card .provider-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.email-provider-card .provider-info {
  flex: 1;
  min-width: 0;
}

.email-provider-card .provider-title {
  font-weight: 700;
  color: var(--text-primary);
}

.email-provider-card .provider-subtitle {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-top: 2px;
}

.email-provider-card .provider-chevron {
  color: var(--text-tertiary, #cbd5e1);
  font-size: 0.9rem;
}

.email-provider-card.accent-gmail .provider-icon {
  background: linear-gradient(135deg, #EA4335, #C5221F);
}

.email-provider-card.accent-outlook .provider-icon {
  background: linear-gradient(135deg, #1E3A8A, #2563EB);
}

.email-provider-card.accent-libero .provider-icon {
  background: linear-gradient(135deg, #FF9800, #F57C00);
}

.email-provider-card.accent-custom .provider-icon {
  background: linear-gradient(135deg, #8B5CF6, #7C3AED);
}

.email-provider-card.accent-manual .provider-icon {
  background: linear-gradient(135deg, #0F172A, #1F2937);
}

.provider-helper {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

[data-theme="dark"] .email-provider-card {
  background: var(--bg-secondary);
}

[data-theme="dark"] .email-provider-card:hover {
  background: rgba(66, 153, 225, 0.08);
}
/* ===================================
   Visibility Selector (Lists, etc.)
   =================================== */

.visibility-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.visibility-option {
  position: relative;
}

.visibility-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.visibility-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1rem 1.2rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--card-bg);
  gap: 0.6rem;
  width: 100%;
}

.visibility-label:hover {
  border-color: var(--primary);
  background: rgba(66, 153, 225, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.visibility-option input[type="radio"]:checked + .visibility-label {
  border-color: var(--primary);
  background: rgba(66, 153, 225, 0.1);
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

.visibility-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: white;
  transition: transform 0.3s ease;
}

.visibility-option:hover .visibility-icon {
  transform: scale(1.1);
}

.visibility-option input[type="radio"]:checked + .visibility-label .visibility-icon {
  animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0.8);
  }
  to {
    transform: scale(1);
  }
}

/* Colori per i diversi livelli di visibilità */
.visibility-option:nth-child(1) .visibility-icon {
  background: linear-gradient(135deg, #6366F1, #4F46E5);
}

.visibility-option:nth-child(2) .visibility-icon {
  background: linear-gradient(135deg, #8B5CF6, #7C3AED);
}

.visibility-option:nth-child(3) .visibility-icon {
  background: linear-gradient(135deg, #06B6D4, #0891B2);
}

.visibility-text {
  flex: 1;
  width: 100%;
}

.visibility-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.visibility-desc {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

/* Dark mode */
[data-theme="dark"] .visibility-label {
  background: var(--bg-secondary);
}

[data-theme="dark"] .visibility-label:hover {
  background: rgba(66, 153, 225, 0.1);
}

[data-theme="dark"] .visibility-option input[type="radio"]:checked + .visibility-label {
  background: rgba(66, 153, 225, 0.15);
}

/* ===================================
   Profile View Styles
   =================================== */

.profile-container {
  max-width: 900px;
}

.profile-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
  border: 1px solid var(--border-color);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 32px;
}

.profile-avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.profile-avatar-large .avatar-initials {
  color: white;
  font-size: 48px;
  font-weight: 700;
}

.profile-info h3 {
  margin: 0 0 12px 0;
  font-size: 24px;
  color: var(--text-primary);
}

.profile-info .email {
  margin: 8px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.profile-info .workspace-name {
  margin: 12px 0 0 0;
  color: var(--text-tertiary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-details .form-group {
  margin-bottom: 16px;
}

.profile-details label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-details input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.profile-details input:disabled {
  opacity: 0.6;
}

.profile-role .role-info {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary);
}

.profile-role .role-description {
  background: rgba(99, 102, 241, 0.05);
  padding: 16px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary);
}

.profile-role .text-small {
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}

.profile-actions .btn {
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all 0.3s ease;
}

.profile-actions .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Dark mode adjustments */
[data-theme="dark"] .profile-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
}

[data-theme="dark"] .profile-role .role-info,
[data-theme="dark"] .profile-role .role-description {
  background: rgba(99, 102, 241, 0.08);
}

/* Profile Preferences */
.profile-preferences {
  background: var(--card-bg);
}

.preference-item {
  padding: 12px 0;
}

.preference-item:first-child {
  padding-top: 0;
}

.preference-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  margin-bottom: 0;
  font-weight: 500;
  color: var(--text-primary);
}

.preference-label:hover {
  color: var(--primary);
}

.preference-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.preference-item hr {
  margin: 12px 0;
  border-color: var(--border-color);
}

.profile-info-footer {
  text-align: center;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

[data-theme="dark"] .preference-label:hover {
  color: #66d9ff;
}

/* ================================================================
   DARK MODE — CHAT PANEL & BUBBLE FIXES
   Fix hardcoded #fff / #f4f6f8 backgrounds in chat panel widget
   ================================================================ */

[data-theme="dark"] .chat-panel {
  background: var(--bg-secondary, #111827);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .chat-messages {
  background: var(--bg-primary, #0f172a);
}

[data-theme="dark"] .chat-message-bubble {
  background: var(--card-bg, #1f2937);
  border-color: var(--border-color, #374151);
  color: var(--text-primary, #f9fafb);
}

[data-theme="dark"] .chat-message.outgoing .chat-message-bubble {
  background: #1a3a2a;
  border-color: #1f4a35;
  color: var(--text-primary, #f9fafb);
}

[data-theme="dark"] .chat-input-container {
  background: var(--bg-secondary, #111827);
  border-top-color: var(--border-color, #374151);
}

[data-theme="dark"] .chat-input {
  background: var(--card-bg, #1f2937);
  border-color: var(--border-color, #374151);
  color: var(--text-primary, #f9fafb);
}

[data-theme="dark"] .chat-message-avatar {
  background: #374151;
  color: #9ca3af;
}

/* QR code always stays white for scanner readability */
[data-theme="dark"] .qr-code-image {
  background: #ffffff;
  border-color: var(--border-color, #374151);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

