/* Chat Status Styles */
.inbox-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

.inbox-status-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  right: 2px;
  border: 1px solid white;
  z-index: 2;
}

.inbox-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #64748b;
  transition: all 0.2s ease;
  margin-right: 8px;
  margin-bottom: 4px;
}

.inbox-filter-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.inbox-filter-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.inbox-count-badge {
  background: #ef4444;
  color: white;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 10px;
  margin-left: 4px;
  min-width: 16px;
  text-align: center;
  display: none;
}

.inbox-status-dropdown {
  position: relative;
  display: inline-block;
}

.inbox-status-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: #64748b;
}

.inbox-status-btn:hover {
  background: #f8fafc;
}

.inbox-status-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  z-index: 1000;
  min-width: 150px;
  display: none;
}

.inbox-status-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.inbox-status-option:hover {
  background-color: #f8fafc;
}

.inbox-status-option:last-child {
  border-bottom: none;
}

/* Mobile responsive fixes */
@media (max-width: 768px) {
  .inbox-filter-btn {
    padding: 4px 8px;
    font-size: 11px;
    margin-right: 4px;
  }

  .inbox-status-dropdown-menu {
    min-width: 120px;
    right: -20px; /* Offset for mobile */
  }

  .inbox-status-btn {
    padding: 3px 6px;
    font-size: 10px;
  }

  .inbox-status-dot {
    width: 6px;
    height: 6px;
  }

  .inbox-status-badge {
    width: 8px;
    height: 8px;
  }
}

/* Accessibility improvements */
.inbox-filter-btn:focus,
.inbox-status-btn:focus,
.inbox-status-option:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Loading states */
.inbox-filter-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Animation improvements */
.inbox-filter-btn,
.inbox-status-btn {
  transition: all 0.2s ease;
}

.inbox-status-dropdown-menu {
  animation: dropdownFadeIn 0.15s ease;
}

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

/* Main area header for filters */
.inbox-main-header {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.inbox-main-header .inbox-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.inbox-main-header .inbox-filter-btn {
  margin-right: 0;
  margin-bottom: 0;
}

/* Hide empty state when filters are in main */
.inbox-main:has(.inbox-main-header) .inbox-empty-state {
  margin-top: 40px;
}

/* Responsive adjustments for main area filters */
@media (max-width: 768px) {
  .inbox-main-header {
    padding: 8px 12px;
  }

  .inbox-main-header .inbox-filters {
    gap: 4px;
  }
}

/* Assign Manager Modal */
.inbox-assign-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
}

.inbox-assign-modal {
  background: white;
  border-radius: 8px;
  padding: 20px;
  min-width: 300px;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.inbox-assign-modal h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.inbox-suggested-manager {
  background: #f0f9ff;
  border: 1px solid #0ea5e9;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 16px;
}

.inbox-suggested-manager p {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: #0c4a6e;
}

.inbox-team-list p {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

.inbox-assign-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 4px;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  transition: all 0.15s ease;
}

.inbox-assign-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.inbox-assign-btn.suggested {
  background: #0ea5e9;
  color: white;
  border-color: #0ea5e9;
  font-weight: 500;
}

.inbox-assign-btn.suggested:hover {
  background: #0284c7;
}

.inbox-assign-btn.current {
  background: #ecfdf5;
  border-color: #22c55e;
  color: #059669;
}

.inbox-assign-btn .role {
  color: #6b7280;
  font-size: 11px;
}

.inbox-assign-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.inbox-assign-actions .inbox-assign-btn {
  flex: 1;
  margin-bottom: 0;
  text-align: center;
}

.inbox-assign-btn.unassign {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

.inbox-assign-btn.unassign:hover {
  background: #fee2e2;
}

.inbox-assign-btn.cancel {
  background: #f3f4f6;
  color: #4b5563;
}

.inbox-assign-btn.cancel:hover {
  background: #e5e7eb;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .inbox-assign-modal {
    margin: 20px;
    min-width: auto;
    max-width: none;
  }
}

/* Quick Replies Panel */
.inbox-quickreply-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s ease;
  margin-right: 8px;
}

.inbox-quickreply-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

.inbox-quickreply-btn:active {
  background: #f1f5f9;
}

/* AI Suggestion Button */
.inbox-ai-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s ease;
  margin-right: 8px;
}

.inbox-ai-btn:hover {
  background: #f0f9ff;
  border-color: #3b82f6;
  color: #3b82f6;
}

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

.inbox-ai-btn:disabled:hover {
  background: none;
  border-color: #e2e8f0;
  color: #64748b;
}

/* AI Spinner Animation */
.ai-spinner {
  animation: ai-spin 1s linear infinite;
}

@keyframes ai-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.inbox-quickreplies-panel {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  max-height: 350px;
  min-width: 300px;
  overflow: hidden;
  animation: quickRepliesFadeIn 0.2s ease;
}

.inbox-quickreplies-panel.mobile {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 70vh;
  border-radius: 12px 12px 0 0;
  animation: quickRepliesSlideUp 0.3s ease;
}

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

@keyframes quickRepliesSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.quickreply-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  background: #fafbfc;
}

.quickreply-search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.quickreply-search-wrap svg {
  position: absolute;
  left: 8px;
  color: #94a3b8;
  pointer-events: none;
}

.quickreply-search {
  width: 100%;
  padding: 6px 8px 6px 28px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 13px;
  background: white;
  outline: none;
  transition: border-color 0.2s;
}

.quickreply-search:focus {
  border-color: #3b82f6;
}

.quickreply-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s ease;
}

.quickreply-close-btn:hover {
  background: #f1f5f9;
  color: #475569;
}

.quickreply-content {
  max-height: 280px;
  overflow-y: auto;
}

.quickreply-group {
  border-bottom: 1px solid #f8fafc;
}

.quickreply-group:last-child {
  border-bottom: none;
}

.quickreply-category {
  padding: 8px 12px 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}

.quickreply-item {
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid #f8fafc;
}

.quickreply-item:hover {
  background: #f8fafc;
}

.quickreply-item:last-child {
  border-bottom: none;
}

.quickreply-title {
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  margin-bottom: 2px;
}

.quickreply-preview {
  font-size: 12px;
  color: #64748b;
  line-height: 1.3;
}

.quickreply-empty {
  padding: 20px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .inbox-quickreply-btn {
    padding: 6px;
    margin-right: 6px;
  }

  .inbox-ai-btn {
    padding: 6px;
    margin-right: 6px;
  }

  .inbox-quickreplies-panel {
    min-width: auto;
  }

  .quickreply-header {
    padding: 16px;
  }

  .quickreply-content {
    max-height: calc(70vh - 80px);
  }

  .quickreply-category {
    padding: 12px 16px 8px 16px;
  }

  .quickreply-item {
    padding: 12px 16px;
  }
}

/* Quick Replies Settings */
.quickreply-group-settings {
  margin-bottom: 24px;
}

.quickreply-category-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 12px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
}

.quickreply-items-list {
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.quickreply-item-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: white;
  transition: background-color 0.15s ease;
}

.quickreply-item-row:last-child {
  border-bottom: none;
}

.quickreply-item-row:hover {
  background: #f9fafb;
}

.quickreply-item-info {
  flex: 1;
}

.quickreply-item-title {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  margin-bottom: 4px;
}

.quickreply-item-preview {
  font-size: 13px;
  color: #64748b;
  line-height: 1.4;
  margin-bottom: 4px;
}

.quickreply-item-meta {
  font-size: 11px;
  color: #94a3b8;
}

.quickreply-item-actions {
  display: flex;
  gap: 4px;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: #f8fafc;
  color: #475569;
}

.btn-icon.btn-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* Mobile responsive for settings */
@media (max-width: 768px) {
  .quickreply-item-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .quickreply-item-actions {
    justify-content: flex-end;
  }
}

/* Broadcasts */
.inbox-sidebar-actions {
  display: flex;
  gap: 8px;
}

.inbox-broadcast-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s ease;
}

.inbox-broadcast-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

.broadcasts-container {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.broadcasts-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #fafbfc;
}

.broadcasts-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #64748b;
  transition: all 0.2s ease;
}

.broadcasts-back-btn:hover {
  background: #f8fafc;
  color: #475569;
}

.broadcasts-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
}

.broadcasts-tabs {
  display: flex;
  background: white;
  border-bottom: 1px solid #e2e8f0;
}

.broadcasts-tab {
  padding: 12px 24px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  transition: all 0.2s ease;
}

.broadcasts-tab:hover {
  color: #475569;
  background: #f8fafc;
}

.broadcasts-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

.broadcasts-content {
  flex: 1;
  overflow: hidden;
}

.broadcasts-tab-content {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.broadcasts-tab-content.active {
  display: block;
}

/* Create broadcast layout */
.broadcast-create-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
  min-height: 500px;
}

.broadcast-filters-panel {
  padding: 20px;
  border-right: 1px solid #e2e8f0;
  background: #f8fafc;
}

.broadcast-message-panel {
  padding: 20px;
  background: white;
}

.broadcast-filters-panel h3,
.broadcast-message-panel h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.broadcast-hint {
  margin: 0 0 16px 0;
  font-size: 13px;
  color: #64748b;
}

.broadcast-filter-group {
  margin-bottom: 20px;
}

.broadcast-filter-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.broadcast-filter-options {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px;
  max-height: 120px;
  overflow-y: auto;
}

.broadcast-filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
}

.broadcast-filter-checkbox:last-child {
  margin-bottom: 0;
}

.broadcast-filter-checkbox input[type="checkbox"] {
  margin: 0;
}

.broadcast-loading,
.broadcast-empty,
.broadcast-error {
  padding: 12px;
  text-align: center;
  font-size: 13px;
  color: #64748b;
}

.broadcast-error {
  color: #dc2626;
}

.broadcast-preview {
  margin-top: 16px;
  padding: 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
}

.broadcast-preview-empty {
  color: #64748b;
  text-align: center;
}

.broadcast-preview-count {
  font-weight: 600;
  color: #059669;
  margin-bottom: 8px;
}

.broadcast-preview-chat {
  margin-bottom: 8px;
  padding: 8px;
  background: #f8fafc;
  border-radius: 4px;
}

.broadcast-preview-chat:last-child {
  margin-bottom: 0;
}

.broadcast-preview-more {
  color: #64748b;
  font-style: italic;
  text-align: center;
  padding: 4px;
}

/* Messages panel */
.broadcast-messages {
  margin-bottom: 16px;
}

.broadcast-message-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 6px;
}

.broadcast-message-item label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-top: 8px;
  min-width: 24px;
}

.broadcast-message-item textarea {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 8px;
  font-size: 13px;
  resize: vertical;
  min-height: 60px;
}

.broadcast-remove-msg {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  margin-top: 4px;
}

.broadcast-remove-msg:hover {
  background: #dc2626;
}

.broadcast-speed {
  margin-bottom: 20px;
}

.broadcast-speed label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.broadcast-speed-options {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.broadcast-speed-btn {
  width: 32px;
  height: 32px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  transition: all 0.15s ease;
}

.broadcast-speed-btn:hover {
  background: #f8fafc;
}

.broadcast-speed-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.broadcast-speed-hint {
  font-size: 12px;
  color: #64748b;
}

.broadcast-name {
  margin-bottom: 20px;
}

.broadcast-name label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.broadcast-name input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 13px;
}

.broadcast-actions {
  display: flex;
  gap: 12px;
}

/* History */
.broadcast-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid #e2e8f0;
}

.broadcast-history-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.broadcast-history-table {
  background: white;
}

.broadcast-history-header-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr;
  gap: 16px;
  padding: 12px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
}

.broadcast-history-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  align-items: center;
}

.broadcast-col-name strong {
  display: block;
  font-size: 14px;
  color: #1e293b;
  margin-bottom: 2px;
}

.broadcast-col-name small {
  font-size: 12px;
  color: #64748b;
}

.broadcast-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.broadcast-status-draft {
  background: #f1f5f9;
  color: #64748b;
}

.broadcast-status-running {
  background: #dbeafe;
  color: #1d4ed8;
}

.broadcast-status-completed {
  background: #dcfce7;
  color: #059669;
}

.broadcast-status-failed {
  background: #fee2e2;
  color: #dc2626;
}

.broadcast-status-cancelled {
  background: #fef3c7;
  color: #d97706;
}

.broadcast-col-actions {
  display: flex;
  gap: 6px;
}

/* Removed duplicate - consolidated below */

/* Mobile responsive */
@media (max-width: 768px) {
  .broadcast-create-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .broadcast-filters-panel {
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }

  .broadcasts-header {
    padding: 12px 16px;
  }

  .broadcasts-tab {
    padding: 10px 16px;
  }

  .broadcast-filters-panel,
  .broadcast-message-panel {
    padding: 16px;
  }

  .broadcast-history-header-row,
  .broadcast-history-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .broadcast-history-header-row {
    display: none;
  }

  .broadcast-history-row {
    padding: 16px;
    background: #f8fafc;
    margin-bottom: 8px;
    border-radius: 6px;
    border: none;
  }

  .broadcast-col-actions {
    flex-wrap: wrap;
    gap: 4px;
  }

  .broadcast-speed-options {
    flex-wrap: wrap;
    gap: 6px;
  }

  .broadcast-actions {
    flex-direction: column;
  }
}

/* Business Hours */
.business-hours-schedule {
  margin: 20px 0;
}

.business-hours-schedule h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.business-hours-day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: 4px;
  background: #f8fafc;
}

.business-hours-day-name {
  min-width: 100px;
}

.business-hours-day-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
}

.business-hours-day-checkbox input[type="checkbox"] {
  margin: 0;
}

.business-hours-day-times {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
}

.business-hours-day-times.disabled {
  opacity: 0.5;
}

.business-hours-day-times input[type="time"] {
  padding: 4px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 12px;
  width: 70px;
}

.business-hours-status {
  margin: 16px 0;
  padding: 12px;
  border-radius: 6px;
  font-size: 13px;
}

.business-hours-status-loading {
  color: #64748b;
  text-align: center;
}

.business-hours-status-open {
  background: #dcfce7;
  border: 1px solid #16a34a;
  color: #15803d;
}

.business-hours-status-closed {
  background: #fee2e2;
  border: 1px solid #dc2626;
  color: #b91c1c;
}

.business-hours-status-error {
  background: #fef3c7;
  border: 1px solid #d97706;
  color: #92400e;
}

.business-hours-status-open small,
.business-hours-status-closed small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.8;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .business-hours-day {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .business-hours-day-name {
    min-width: auto;
  }

  .business-hours-day-times {
    justify-content: center;
  }
}

/* Tags System */
.inbox-chat-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.inbox-chat-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 500;
  border: 1px solid;
  white-space: nowrap;
}

.inbox-chat-tag-more {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 500;
  background-color: var(--bg-muted, #f8f9fa);
  color: var(--text-muted, #6c757d);
  border: 1px solid var(--border-color, #dee2e6);
}

/* Contact Panel Tags */
.inbox-cp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  min-height: 20px;
}

.inbox-cp-tags-empty {
  color: var(--text-muted, #6c757d);
  font-size: 12px;
  font-style: italic;
  margin-bottom: 8px;
}

.inbox-cp-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid;
  white-space: nowrap;
}

.inbox-cp-tag-remove {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.inbox-cp-tag-remove:hover {
  opacity: 1;
}

.inbox-cp-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px dashed var(--border-color, #dee2e6);
  border-radius: 12px;
  background: none;
  color: var(--text-muted, #6c757d);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.inbox-cp-tag-btn:hover {
  border-color: var(--primary-color, #007bff);
  color: var(--primary-color, #007bff);
}

/* Settings Page Tag Preview */
.tag-preview {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid;
  white-space: nowrap;
}

/* Analytics Styles */
.analytics-container {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.analytics-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  background: white;
}

.analytics-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  background: white;
  color: var(--text-color, #1f2937);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s ease;
}

.analytics-back-btn:hover {
  background: var(--bg-hover, #f8f9fa);
  border-color: var(--border-hover, #d1d5db);
}

.analytics-header-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.analytics-header-content h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-color, #1f2937);
}

.analytics-period-selector {
  display: flex;
  gap: 4px;
  background: var(--bg-muted, #f8f9fa);
  padding: 2px;
  border-radius: 6px;
}

.analytics-period-btn {
  padding: 6px 12px;
  border: none;
  background: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-muted, #6b7280);
}

.analytics-period-btn.active,
.analytics-period-btn:hover {
  background: white;
  color: var(--text-color, #1f2937);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.analytics-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--bg-page, #f8f9fa);
}

.analytics-loading,
.analytics-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  gap: 16px;
  color: var(--text-muted, #6b7280);
  font-size: 14px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color, #e2e8f0);
  border-top: 3px solid var(--primary-color, #3b82f6);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Summary Cards */
.analytics-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.analytics-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  text-align: center;
  transition: box-shadow 0.15s ease;
}

.analytics-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.analytics-card-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.analytics-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-color, #1f2937);
  margin-bottom: 4px;
}

.analytics-card-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sections */
.analytics-section {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  padding: 20px;
  margin-bottom: 24px;
}

.analytics-section h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color, #1f2937);
}

/* Two Columns Layout */
.analytics-two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.analytics-column {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  padding: 20px;
}

.analytics-column h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color, #1f2937);
}

/* Stats List */
.analytics-stats-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.analytics-stat-item {
  display: grid;
  grid-template-columns: 16px 1fr auto auto;
  grid-template-rows: auto auto;
  gap: 8px 12px;
  align-items: center;
}

.analytics-stat-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  grid-row: 1;
}

.analytics-stat-emoji {
  font-size: 14px;
  text-align: center;
  grid-row: 1;
}

.analytics-stat-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-color, #1f2937);
  grid-row: 1;
}

.analytics-stat-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color, #1f2937);
  grid-row: 1;
}

.analytics-stat-percent {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  grid-row: 1;
}

.analytics-stat-bar {
  grid-column: 1 / -1;
  height: 4px;
  background: var(--bg-muted, #f1f5f9);
  border-radius: 2px;
  overflow: hidden;
}

.analytics-stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Chart */
.analytics-chart-container {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  padding: 20px;
}

.analytics-chart {
  width: 100%;
}

.analytics-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 16px;
}

.analytics-chart-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.analytics-chart-bars-container {
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  position: relative;
}

.analytics-chart-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: all 0.3s ease;
}

.analytics-chart-bar-new {
  background-color: #3b82f6;
}

.analytics-chart-bar-closed {
  background-color: #10b981;
}

.analytics-chart-label {
  font-size: 11px;
  color: var(--text-muted, #6b7280);
  margin-top: 8px;
  text-align: center;
}

.analytics-chart-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.analytics-chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}

.analytics-chart-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.analytics-chart-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted, #6b7280);
  font-size: 14px;
}

/* Table */
.analytics-table-container {
  overflow-x: auto;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.analytics-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.analytics-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border-color, #f1f5f9);
  color: var(--text-color, #1f2937);
}

.analytics-table tr:hover {
  background: var(--bg-hover, #f8f9fa);
}

/* Tags */
.analytics-tags {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analytics-tag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.analytics-tag-chip {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid;
}

.analytics-tag-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
}

/* Broadcasts */
.analytics-broadcast-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analytics-broadcast-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.analytics-broadcast-label {
  font-size: 13px;
  color: var(--text-color, #1f2937);
}

.analytics-broadcast-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color, #1f2937);
}

.analytics-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-muted, #6b7280);
  font-size: 13px;
  font-style: italic;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .analytics-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .analytics-two-columns {
    grid-template-columns: 1fr;
  }

  .analytics-header {
    padding: 12px 16px;
  }

  .analytics-content {
    padding: 16px;
  }

  .analytics-header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .analytics-chart-bars {
    gap: 4px;
  }

  .analytics-chart-label {
    font-size: 10px;
    transform: rotate(-45deg);
    margin-top: 12px;
  }
}
/* ===== INBOX AVATAR PHOTOS ===== */
.inbox-avatar-photo, .inbox-cp-avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.inbox-chat-avatar .inbox-avatar-photo {
  position: absolute;
  top: 0;
  left: 0;
}

.inbox-cp-avatar img.inbox-cp-avatar-photo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
}

/* ===== SETTINGS FUNNELS DESIGN ===== */

/* Settings block container - extends existing card system */
.settings-block {
  background: var(--bg-card, #ffffff);
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-sm);
  border: 0.5px solid var(--border, #e2e8f0);
  overflow: hidden;
  margin-bottom: 24px;
}

.settings-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-light, #f1f5f9);
  background: var(--bg-secondary, #f8fafc);
}

.settings-block-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0;
  letter-spacing: -0.025em;
}

.settings-block-desc {
  font-size: 14px;
  color: var(--text-muted, #64748b);
  margin: 4px 0 0;
  font-weight: 400;
}

/* Button styling now uses existing .u-btn-primary class */

/* Funnel settings list */
.fsl-list {
  padding: 0 28px 28px;
}

.fsl-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: var(--bg-card, #ffffff);
  border: 0.5px solid var(--border, #e2e8f0);
  border-radius: var(--radius-md, 10px);
  margin-bottom: 16px;
  transition: all var(--duration-fast, 0.2s) var(--ease-default, ease);
  position: relative;
  overflow: hidden;
}

.fsl-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--funnel-color, var(--text-muted, #64748b));
  opacity: 0;
  transition: opacity var(--duration-fast, 0.2s) var(--ease-default, ease);
}

.fsl-card:hover {
  border-color: var(--border-hover, #cbd5e1);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.fsl-card:hover::before {
  opacity: 1;
}

.fsl-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.fsl-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(var(--funnel-rgb), 0.1);
}

.fsl-name {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 6px;
  line-height: 1.3;
}

.fsl-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.fsl-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.fsl-stat {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.fsl-sys {
  background: #fef3c7;
  color: #d97706;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fsl-actions {
  display: flex;
  gap: 8px;
}

.fsl-btn {
  padding: 8px 16px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fsl-btn:hover {
  border-color: #3b82f6;
  color: #3b82f6;
  background: #f8fafc;
}

.fsl-btn-del {
  border-color: #fecaca;
  color: #dc2626;
  background: #fef2f2;
}

.fsl-btn-del:hover {
  border-color: #dc2626;
  background: #fee2e2;
}

/* Settings error state */
.settings-error {
  padding: 24px;
  text-align: center;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  margin: 20px;
  font-size: 14px;
}

/* Responsive design */
@media (max-width: 768px) {
  .settings-block-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
  }

  .settings-block-header .u-btn-primary {
    width: 100%;
  }

  .fsl-list {
    padding: 0 20px 20px;
  }

  .fsl-card {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 16px;
  }

  .fsl-left {
    gap: 12px;
  }

  .fsl-actions {
    justify-content: flex-end;
  }

  .fsl-meta {
    gap: 8px;
  }

  .fsl-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .settings-block-title {
    font-size: 18px;
  }

  .fsl-actions {
    flex-direction: column;
    gap: 6px;
  }

  .fsl-btn {
    width: 100%;
    text-align: center;
  }
}

/* ===== FUNNEL SETTINGS EDITOR MODAL ===== */

/* Overlay and Modal */
.fse-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.fse-modal {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.fse-mhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.fse-mhead h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}

.fse-xbtn2 {
  background: none;
  border: none;
  font-size: 24px;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.fse-xbtn2:hover {
  background: #f1f5f9;
  color: #334155;
}

.fse-mbody {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
}

/* Tabs */
.fse-tabs {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 28px;
  gap: 8px;
}

.fse-tab {
  background: none;
  border: none;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: all 0.2s ease;
  position: relative;
}

.fse-tab.active {
  color: #3b82f6;
  background: #f8fafc;
}

.fse-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: #3b82f6;
}

.fse-tab:hover:not(.active) {
  color: #475569;
  background: #f8fafc;
}

/* Form Elements */
.fse-wrap {
  width: 100%;
}

.fse-row {
  margin-bottom: 20px;
}

.fse-row label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.fse-row input,
.fse-row select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.fse-row input:focus,
.fse-row select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.fse-row2 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
  margin-bottom: 20px;
}

.fse-row2 label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.fse-row2 input,
.fse-row2 select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
}

/* Dividers and Subtitles */
.fse-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 32px 0;
}

.fse-subtitle {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 20px;
}

/* Toggle Rows */
.fse-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid #f1f5f9;
}

.fse-toggle-row:last-child {
  border-bottom: none;
}

.fse-tl {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.fse-td {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
}

/* Custom Toggle Switch */
.fse-tog {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
  cursor: pointer;
}

.fse-tog input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
}

.fse-tog-sl {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #d1d5db;
  border-radius: 24px;
  transition: all 0.3s ease;
}

.fse-tog-sl:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fse-tog input:checked + .fse-tog-sl {
  background: #3b82f6;
}

.fse-tog input:checked + .fse-tog-sl:before {
  transform: translateX(24px);
}

/* Stages */
.fse-stage-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.fse-stage-row.dragging {
  opacity: 0.5;
  transform: scale(0.95);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  position: relative;
}

.fse-stage-row.drag-over {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: scale(1.02);
}

.fse-handle {
  cursor: grab;
  color: #9ca3af;
  font-size: 18px;
  user-select: none;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.fse-handle:hover {
  color: #6b7280;
  background: #e5e7eb;
}

.fse-handle:active {
  cursor: grabbing;
}

.fse-sname {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.fse-scolor {
  width: 40px;
  height: 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.fse-stage-row label {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: #6b7280;
  margin: 0;
  gap: 4px;
}

.fse-chk {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.fse-chk:hover {
  background: #f1f5f9;
  color: #475569;
}

.fse-chk input[type="checkbox"] {
  margin: 0;
  width: auto;
  height: auto;
}

.fse-xbtn {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.fse-xbtn:hover {
  background: #fecaca;
}

.fse-add-btn {
  width: 100%;
  padding: 12px;
  background: #f8fafc;
  color: #3b82f6;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fse-add-btn:hover {
  background: #f1f5f9;
  border-color: #3b82f6;
}

.fse-hint {
  font-size: 13px;
  color: #6b7280;
  background: #fef3c7;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  border-left: 3px solid #f59e0b;
}

/* Managers List */
.fse-managers-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.fse-manager-chk {
  display: block;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fse-manager-chk:last-child {
  margin-bottom: 0;
}

.fse-manager-chk:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.fse-manager-chk input[type="checkbox"] {
  margin-right: 8px;
  accent-color: #3b82f6;
}

.fse-mgr-role {
  font-size: 12px;
  color: #6b7280;
  margin-left: 8px;
  font-weight: 500;
  background: #e5e7eb;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Stage Templates */
.fse-tpl-row {
  margin-bottom: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.fse-tpl-stage {
  padding: 12px 16px;
  background: #f8fafc;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e2e8f0;
}

.fse-tpl-text {
  width: 100%;
  min-height: 60px;
  padding: 12px 16px;
  border: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: #374151;
  background: #ffffff;
  resize: vertical;
  transition: all 0.2s ease;
}

.fse-tpl-text:focus {
  outline: none;
  background: #f9fafb;
}

.fse-tpl-text::placeholder {
  color: #9ca3af;
  font-style: italic;
}

/* Automation specific inputs */
.fse-row input[type="time"] {
  padding: 8px 12px;
  font-size: 14px;
}

.fse-row input[type="number"] {
  padding: 8px 12px;
  font-size: 14px;
}

/* Configuration sections */
.fse-autoassign-cfg,
.fse-reminders-cfg,
.fse-autofill-cfg {
  margin-left: 20px;
  padding-left: 20px;
  border-left: 3px solid #e5e7eb;
  margin-top: 16px;
}

/* Special styling for repeat sales section */
.fse-repeat-sales-section {
  background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
  padding: 20px;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  margin-top: 20px;
}

/* Footer and Action Buttons */
.fse-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 28px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  margin: 28px -28px -28px;
}

.fse-cancel {
  background: #ffffff;
  color: #6b7280;
  border: 1px solid #d1d5db;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fse-cancel:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  color: #374151;
}

.fse-save {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.fse-save:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .fse-overlay {
    padding: 10px;
  }

  .fse-modal {
    max-width: none;
    width: 100%;
  }

  .fse-mhead {
    padding: 16px 20px;
  }

  .fse-mbody {
    padding: 20px;
  }

  .fse-row2 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .fse-stage-row {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* ===== SALARY RULES STYLES ===== */
.salary-rules-container {
  min-height: 200px;
}

.salary-role-group {
  margin-bottom: 32px;
}

.salary-role-group h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #374151;
  font-weight: 600;
  margin-bottom: 16px;
  font-size: 16px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 8px;
}

.salary-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.salary-rule-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  position: relative;
  transition: all 0.2s ease;
}

.salary-rule-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.salary-rule-card.inactive {
  opacity: 0.6;
  background: #f9fafb;
}

.rule-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.rule-name {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin: 0;
  line-height: 1.4;
  flex: 1;
}

.rule-actions {
  display: flex;
  gap: 4px;
  margin-left: 12px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.btn-icon:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.btn-icon.text-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

.rule-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rule-details > div {
  display: flex;
  align-items: center;
  font-size: 14px;
}

.rule-details .label {
  font-weight: 500;
  color: #6b7280;
  min-width: 60px;
  margin-right: 8px;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
}

.rule-inactive {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #fbbf24;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.form-row .form-group {
  margin-bottom: 16px;
}

.empty-state {
  background: #fafbfc;
  border: 2px dashed #e5e7eb;
  border-radius: 12px;
  text-align: center;
  padding: 48px 24px;
}

.empty-state .icon {
  font-size: 48px;
  color: #d1d5db;
  margin-bottom: 16px;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
}

.checkbox-wrapper input[type="checkbox"] {
  margin-right: 8px;
}

.checkbox-wrapper .checkmark {
  margin-left: 4px;
}

/* Modal adjustments for salary rules */
#salary-rule-modal .modal-content {
  max-width: 600px;
}

#salary-rule-modal .form-control {
  font-size: 14px;
}

#salary-rule-modal .form-group label {
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

/* Period management styles */
.period-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.period-row:hover {
  border-color: #d1d5db;
}

.period-row .form-control {
  font-size: 13px;
}

.period-row .remove-period-btn {
  margin-left: 8px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

#periods-container {
  min-height: 60px;
}

#periods-container:empty::before {
  content: "Натисніть 'Додати період' щоб створити діапазон дат";
  display: block;
  color: #9ca3af;
  font-style: italic;
  text-align: center;
  padding: 24px;
  border: 2px dashed #e5e7eb;
  border-radius: 8px;
  background: #fafbfc;
}

/* Calculator Management Styles */
.calc-types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.calc-type-card {
  transition: all 0.2s ease;
}

.calc-type-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.calc-products-table {
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.calc-products-table table {
  background: transparent;
}

.calc-products-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.calc-products-table td {
  vertical-align: middle;
}

.calc-products-table code {
  background: var(--bg-accent);
  color: var(--text-accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* Calculator form styles */
#calculator-form .input-sm {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

#calculator-form .input-sm:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#calculator-form label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: var(--text-primary);
}

#calculator-form small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

/* Responsive design for calculator admin */
@media (max-width: 768px) {
  .calc-types-grid {
    grid-template-columns: 1fr;
  }

  .calc-type-card {
    padding: 12px;
  }

  .calc-products-table {
    font-size: 14px;
  }

  .calc-products-table th,
  .calc-products-table td {
    padding: 8px;
  }
}

/* Loading state for modal */
.modal-loading {
  pointer-events: none;
  opacity: 0.6;
}

/* Success feedback for form */
.form-success {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Error state for inputs */
.form-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

/* Period row animation */
.period-row {
  animation: slideIn 0.2s ease-out;
}

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

/* Responsive styles */
@media (max-width: 768px) {
  .salary-rules-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    flex-direction: column;
  }

  .form-row .form-group {
    margin-left: 0 !important;
  }

  .rule-header {
    flex-direction: column;
    gap: 12px;
  }

  .rule-actions {
    margin-left: 0;
    align-self: flex-start;
  }

  .period-row {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .period-row > span {
    text-align: center;
    order: 1;
  }

  .period-row .remove-period-btn {
    align-self: center;
    order: 2;
    margin-left: 0;
  }
}

/* Salary Rule Card Animation Styles */
.salary-rule-card {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.salary-rule-card.deleting {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

.salary-role-group.empty {
  opacity: 0;
  height: 0;
  margin-bottom: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, height 0.3s ease, margin 0.3s ease;
}

