html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Remove all blue outlines - use subtle shadows instead */
button:focus,
input:focus,
select:focus,
textarea:focus,
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus,
.form-select:focus,
a:focus {
  outline: none !important;
}

/* Provide subtle visual feedback for accessibility */
.btn:focus:not(:disabled),
.btn:active:focus:not(:disabled) {
  box-shadow: 0 0 0 3px rgba(61, 16, 25, 0.08) !important;
}

.form-control:focus,
.form-select:focus {
  box-shadow: 0 0 0 3px rgba(61, 16, 25, 0.06) !important;
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(61, 16, 25, 0.06) !important;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background: #C7B7A333;
  min-height: 100vh;
}

/* Matter Folders Styles */
.matter-folder-card {
  background-color: #ffffff;
  border-radius: 12px;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  height: 100px; /* Fixed height for all cards */
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.matter-folder-card:hover {
  background-color: #eef1f3;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2) !important;
}

/* Ensure card body content is vertically centered */
.matter-folder-card .card-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px; /* Match card height */
  padding: 1rem;
}

/* Ensure the main content container is properly centered */
.matter-folder-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Ensure text content is vertically centered within its container */
.matter-folder-content .flex-grow-1 {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
}

/* Ensure all cards in the row have equal height */
.row.g-3 .col-md-6.col-lg-3 {
  display: flex;
}

.matter-folder-card {
  flex: 1;
}

/* Horizontal scrollable matters container */
.matters-scroll-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(155, 155, 155, 0.7) transparent;
  padding-bottom: 0.5rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.matters-scroll-container::-webkit-scrollbar {
  height: 8px;
}

.matters-scroll-container::-webkit-scrollbar-track {
  background: transparent;
  margin-top: 0.5rem;
}

.matters-scroll-container::-webkit-scrollbar-thumb {
  background-color: rgba(155, 155, 155, 0.7);
  border-radius: 4px;
}

.matters-scroll-container::-webkit-scrollbar-thumb:hover {
  background-color: rgba(100, 100, 100, 0.9);
}

/* Matters page stats cards vertical centering */
.row.mb-4 .col-md-3.mb-3 {
  display: flex;
}

.row.mb-4 .col-md-3.mb-3 .card {
  flex: 1;
  height: 120px; /* Fixed height for stats cards */
}

.row.mb-4 .col-md-3.mb-3 .card .card-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px; /* Match card height */
  padding: 1rem;
}

.row.mb-4 .col-md-3.mb-3 .card .card-body .d-flex {
  width: 100%;
  justify-content: center;
}

/* Teams Page Styles */
.team-member-card {
  transition: all 0.2s ease-in-out;
  background-color: rgba(248, 250, 252, 0.4); /* white background */
}

.team-member-card:hover {
  background-color: #dee2e6; /* unified hover surface */
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.team-member-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.team-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.team-section-header i {
  color: #3d1019;
  font-size: 1.5rem;
}

.team-section-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
}

.team-badge {
  background-color: #f3f4f6;
  color: #6b7280;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Search and Filter Styles */
.search-container {
  position: relative;
}

.search-container i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  z-index: 10;
}

.search-container input,
.search-container input.form-control {
  padding: 0.5rem 1rem;
  padding-left: 2.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
  transition: all 0.2s ease;
  font-size: 0.875rem;
  font-weight: 400;
}

.search-container input:focus,
.search-container input.form-control:focus {
  outline: none;
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Page Header Search Bar Focus State - Match Email Inbox */
#headerSearchContainer input {
  transition: all 0.2s ease;
}

#headerSearchContainer input:focus {
  outline: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
  background-color: white !important;
}

/* Large Search Container - matches AI Chat input styling */
.search-container-large {
  display: flex;
  align-items: center;
  background-color: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 24px;
  transition: all 0.2s ease;
  position: relative;
}

.search-container-large:focus-within {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.search-container-large > i.fa-plus {
  color: #6b7280;
  padding: 0.5rem;
  margin-left: 0.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-container-large > i.fa-plus:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: #9d5252;
}

.search-container-large input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: #374151;
  outline: none;
  box-shadow: none !important;
}

.search-container-large input::placeholder {
  color: #9ca3af;
}

.search-container-large .search-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-right: 0.25rem;
}

.search-container-large .search-actions .btn {
  padding: 0;
  border: none;
  background: transparent;
  transition: all 0.2s ease;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
}

.search-container-large .search-actions .btn:hover,
.search-container-large .search-actions .btn:focus {
  background-color: rgba(0, 0, 0, 0.05);
  text-decoration: none !important;
}

.search-container-large .search-actions .btn i {
  font-size: 1.1rem;
  color: #6b7280;
}

.search-container-large .search-actions .btn:hover i {
  color: #9d5252;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid #e5e7eb;
  background-color: white;
  color: #374151;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}

.filter-button:hover {
  background-color: #f9fafb;
  border-color: #3d1019;
  color: #3d1019;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Modern Chat Styles */
.sidebar {
  background-color: #ffffff;
  border-right: 1px solid #e5e7eb;
  min-height: calc(100vh - 56px);
  padding: 1rem;
  box-shadow: 2px 0 4px rgba(0,0,0,0.05);
}

.conversation-list {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.conversation-item {
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: #ffffff;
  user-select: none;
}

.conversation-item:hover {
  background-color: #f9fafb;
  border-color: #3d1019;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(11, 54, 94, 0.15);
}

.conversation-item.active {
  background: linear-gradient(135deg, #3d1019, #3d1019);
  color: white;
  border-color: #3d1019;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.conversation-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.conversation-preview {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.conversation-item.active .conversation-preview {
  color: white;
}

.conversation-item.active .conversation-meta small {
  color: white !important;
}

.conversation-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  background-color: #ffffff;
  position: relative;
}

/* Mobile Header */
.mobile-header {
  display: none;
  padding: 1rem;
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-info h5 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1f2937;
}

.status-indicator {
  font-size: 0.8rem;
  color: #10b981;
  font-weight: 500;
}

.chat-header {
  padding: 1rem 0.5rem 1rem 1rem; /* Double horizontal padding and add top padding */
  background-color: #ffffff;
  border-bottom: none; /* Remove border to connect with tabs */
  margin: 0 0.5rem;
  box-sizing: border-box;
  margin-top: 0; /* Ensure no top margin */
}

.chat-header-content {
  display: flex;
  align-items: center;
}

.ai-assistant-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ai-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3d1019, #3d1019);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(11, 54, 94, 0.3);
}

.ai-details h5 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1f2937;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  animation: pulse 2s infinite;
}

.status-text {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Red Loading Spinner - Brand Color */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(61, 16, 25, 0.1);
  border-top-color: #3d1019;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.chat-messages {
  flex: 1;
  padding: 1rem 0.5rem 1rem 1rem;
  overflow-y: auto;
  background-color: #ffffff;
  scroll-behavior: smooth;
  margin: 0 0.5rem;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  /* Firefox scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* Custom Scrollbar Styling for AI Chat */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.35);
}

.chat-input {
  padding: 0rem 0.5rem 1rem 0.5rem;
  border-top: 1px solid #e5e7eb;
  background-color: #ffffff;
  position: relative;
  margin: 0 0.5rem;
  box-sizing: border-box;
}

/* Landing mode: input at top */
.chat-content.landing-mode .chat-messages {
  order: 2;
}

.chat-content.landing-mode .chat-input {
  order: 1;
  padding: 0.5rem;
  border-top: none;
  border-bottom: none;
}

/* Modern Message Bubbles */
.welcome-message {
  margin-bottom: 2rem;
}

/* Welcome Message and Conversation Header Styling */
.welcome-message .ai-message-bubble,
.notal-conversation-header .ai-message-bubble {
  margin-top: 0;
  margin-bottom: 0;
}

.welcome-message .message-text,
.notal-conversation-header .message-text {
  background-color: transparent;
  padding: 0 0.75rem 1.25rem 0.75rem;
}

.ai-message-bubble {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  margin-top: 1rem;
}

.ai-message-bubble .message-content {
  border-radius: 18px;
  border-top-left-radius: 4px;
}

.user-message-bubble {
  display: flex;
  align-items: flex-start;
  margin-bottom: 2rem;
  width: 100%;
  margin-left: auto;
}

.user-message-bubble .message-content {
  width: 100%;
}

.message-avatar {
  margin-right: 0.75rem;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #3d1019;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

/* Current user's message avatar gets the linear gradient */
.message-item.current-user-message .message-avatar {
  background: linear-gradient(135deg, #a32b43, #3d1019) !important;
}

.user-message-bubble .message-avatar {
  margin-right: 0;
  margin-left: 0.75rem;
}

.avatar-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3d1019, #3d1019);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(11, 54, 94, 0.3);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a32b43, #3d1019);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.25rem;
  gap: 0.5rem;
}

.ai-message-logo {
  height: 1.25rem;
  width: auto;
  object-fit: contain;
  margin-right: 0.25rem;
}

.sender-name {
  font-weight: 600;
  color: #1f2937;
  font-size: 0.9rem;
}

.you-label {
  font-weight: 500;
  color: #888888;
  font-size: 0.9em;
}

.ai-badge {
  background-color: #f3f4f6;
  color: #6b7280;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.timestamp {
  color: #9ca3af;
  font-size: 0.75rem;
  margin-left: auto;
}

.message-text {
  background-color: transparent;
  border-radius: 18px;
  border-top-left-radius: 4px;
  line-height: 1.5;
  color: #374151;
  font-size: 0.85rem;
}

.user-message-bubble .message-text {
  background: white !important;
  color: #374151 !important;
  padding: 0.75rem !important;
  border-radius: 16px !important;
  line-height: 1.5;
  font-size: 0.85rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25) !important;
  border: none !important;
}

/* Sources Section */
.sources-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.sources-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.source-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  color: #3d1019;
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s ease;
}

.source-link:hover {
  color: #3d1019;
  text-decoration: none;
}

.source-link i {
  margin-left: 0.5rem;
  font-size: 0.75rem;
}

/* Input Container */
.input-container {
  display: flex;
  align-items: center;
  background-color: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 24px;
  padding: 0.5rem;
  transition: all 0.2s ease;
}

.input-container:focus-within {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.message-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  color: #374151;
  outline: none;
}

.message-input::placeholder {
  color: #9ca3af;
}

.send-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #9d5252;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(11, 54, 94, 0.3);
}

.send-button:hover {
  transform: scale(1.05);
  background: #914040;
  box-shadow: 0 4px 12px rgba(11, 54, 94, 0.4);
}

.send-button:active {
  transform: scale(0.95);
}

/* AI Chat Input Actions Row */
.input-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding-top: 0.5rem;
  gap: 0.5rem;
}

.input-action-buttons {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex: 0 1 auto;
}

.input-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.input-action-btn:hover {
  background: rgba(61, 16, 25, 0.1);
  color: #3d1019;
}

.input-action-btn.active {
  background: rgba(61, 16, 25, 0.15);
  color: #3d1019;
}

.char-counter {
  font-size: 0.75rem;
  color: #9ca3af;
  white-space: nowrap;
  flex-shrink: 0;
}

.char-counter.warning {
  color: #f59e0b;
}

.char-counter.limit {
  color: #ef4444;
}

/* AI Result Styling */
.ai-result {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.ai-result pre {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.85rem;
  color: #4a5568;
}

.clarity-message {
  border-left: 4px solid #3d1019;
  background-color: rgba(11, 54, 94, 0.03);
}

.clarity-explanation h6 {
  color: #3d1019;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.ai-agents {
  margin-top: 1rem;
}

.agent-card {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.agent-card:hover {
  background-color: #eef1f3;
  border-color: #0d6efd;
}

.agent-card.active {
  background-color: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

.agent-icon {
  font-size: 1.5rem;
  margin-right: 0.75rem;
}

.agent-info h6 {
  margin: 0 0 0.25rem 0;
  font-size: 0.875rem;
}

.agent-info p {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.8;
}

/* AI Insights Panel */
.ai-insights-panel {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  overflow: hidden;
}

.ai-insights-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: #ffffff;
  border-bottom: 1px solid #dee2e6;
}

.ai-insights-header h6 {
  margin: 0;
  color: #495057;
  font-weight: 600;
}

.ai-insights-content {
  padding: 1rem;
}

.ai-insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.ai-insight-card {
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ai-insight-card h6 {
  color: #0d6efd;
  margin-bottom: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-insight-card p {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.ai-insight-card ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.ai-insight-card li {
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.suggestion-preview {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  padding: 0.75rem;
  margin: 0.5rem 0;
  font-style: italic;
  font-size: 0.875rem;
}

.suggestion-meta {
  margin-bottom: 0.75rem;
}

.suggestion-meta .badge {
  margin-right: 0.5rem;
  margin-bottom: 0.25rem;
}

.suggestion-keypoints {
  margin-top: 0.75rem;
}

.suggestion-keypoints h6 {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: #495057;
}

.suggestion-keypoints ul {
  margin: 0;
  padding-left: 1rem;
}

.suggestion-keypoints li {
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

/* Chat Actions */
.chat-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.chat-actions .btn {
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
}

/* Clarity Modal Styles */
#clarityResult {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #dee2e6;
}

#clarityKeyTerms .badge {
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}

#clarityImplications {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

#clarityImplications li {
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

/* Suggestion Modal Styles */
.suggestion-card {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 1rem;
}

.suggestion-text {
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  padding: 0.75rem;
  margin: 0.75rem 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .container-fluid {
    padding: 0;
  }
  
  .row {
    margin: 0;
  }
  
  .sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    background-color: white;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.show {
    display: block;
    transform: translateX(0);
  }
  
  .col-md-9 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0;
  }
  
  .mobile-header {
    display: flex !important;
  }
  
  .chat-header {
    display: none;
  }
  
  .chat-container {
    height: 100vh;
  }
  
  .chat-messages {
    padding: 0.25rem 0.1rem 100px 1rem; /* top right bottom left - match AI header left padding */
  }
  
  .chat-input {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    z-index: 100;
  }
  
  .ai-message-bubble,
  .user-message-bubble {
    width: 100%;
  }
  
  .message-text {
    font-size: 0.9rem;
  }
  
  .ai-insights-grid {
    grid-template-columns: 1fr;
  }
  
  .chat-actions {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .input-container {
    margin: 0 1rem;
  }
  
  .message-input {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Tablet adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
  .ai-message-bubble,
  .user-message-bubble {
    width: 100%;
  }
  
  .chat-messages {
    padding: 1.25rem 0.1rem 1.25rem 1rem; /* top right bottom left - match AI header left padding */
  }
}

/* Large screen optimizations */
@media (min-width: 1200px) {
  .chat-messages {
    padding: 1rem 0.5rem; /* Consistent with mobile */
  }
  
  .ai-message-bubble,
  .user-message-bubble {
    width: 100%;
  }
}

/* AI Thinking Indicator Styles */
.thinking-message {
  opacity: 0.8;
  animation: pulse 2s infinite;
}

.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.thinking-dots {
  display: flex;
  gap: 0.25rem;
}

.thinking-dots span {
  width: 8px;
  height: 8px;
  background-color: #6b7280;
  border-radius: 50%;
  animation: thinkingDots 1.4s infinite ease-in-out both;
}

.thinking-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0s;
}

.thinking-text {
  color: #6b7280;
  font-style: italic;
  font-size: 0.9rem;
  animation: pulsateText 2s ease-in-out infinite;
}

.thinking-text span {
  display: inline-block;
  animation: pulsateText 2s ease-in-out infinite;
}

@keyframes thinkingDots {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
}

/* AI Message Formatting Styles */
.ai-summary,
.ai-goal,
.ai-reply,
.ai-clarity {
  background: #f8f9fa;
  border: 1px solid #eef1f3;
  border-radius: 8px;
  padding: 1rem;
  margin: 0.5rem 0;
}

.ai-summary h6,
.ai-goal h6,
.ai-reply h6,
.ai-clarity h6 {
  color: #495057;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.ai-summary-error,
.ai-goal-error,
.ai-reply-error {
  background: rgba(11, 54, 94, 0.1);
  border: 1px solid rgba(11, 54, 94, 0.2);
  border-radius: 8px;
  padding: 1rem;
  margin: 0.5rem 0;
  color: #856404;
}

.key-points,
.secondary-goals,
.required-documents,
.suggested-actions,
.reply-keypoints,
.implications {
  margin-top: 0.75rem;
}

.key-points ul,
.secondary-goals ul,
.required-documents ul,
.suggested-actions ul,
.reply-keypoints ul,
.implications ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.key-points li,
.secondary-goals li,
.required-documents li,
.suggested-actions li,
.reply-keypoints li,
.implications li {
  margin: 0.25rem 0;
}

.reply-meta {
  margin: 0.75rem 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.suggested-reply {
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 1rem;
  margin: 0.75rem 0;
  font-style: italic;
}

.key-terms {
  margin: 0.75rem 0;
}

.key-terms .badge {
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}

.ai-result pre {
  background: #f8f9fa;
  border: 1px solid #eef1f3;
  border-radius: 4px;
  padding: 0.75rem;
  margin: 0;
  font-size: 0.875rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* AI Insights Panel Styles */
.ai-insights-container {
  padding: 1rem;
}

.insight-card {
  background: #ffffff;
  border: 1px solid #eef1f3;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease;
}

.insight-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.insight-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: #495057;
  font-weight: 600;
  font-size: 0.95rem;
}

.insight-content {
  color: #6c757d;
  line-height: 1.5;
}

.summary-text {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  color: #495057;
}

.summary-meta {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.key-points,
.suggested-actions,
.secondary-goals,
.required-docs,
.reply-key-points {
  margin-top: 0.75rem;
}

.key-points ul,
.suggested-actions ul,
.secondary-goals ul,
.required-docs ul,
.reply-key-points ul {
  margin: 0.5rem 0 0 0;
  padding-left: 1rem;
}

.key-points li,
.suggested-actions li,
.secondary-goals li,
.required-docs li,
.reply-key-points li {
  margin: 0.25rem 0;
  font-size: 0.85rem;
  color: #6c757d;
}

.reply-suggestion {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 1rem;
  margin: 0.75rem 0;
}

.suggested-reply {
  font-style: italic;
  color: #495057;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.reply-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.badge-success {
  background-color: #28a745;
  color: white;
}

.badge-danger {
  background-color: #dc3545;
  color: white;
}

.badge-warning {
  background-color: #3d1019;
  color: #212529;
}

.badge-info {
  background-color: #17a2b8;
  color: white;
}

.badge-secondary {
  background-color: #6c757d;
  color: white;
}

/* AI Insights Panel Toggle */
#aiInsightsPanel {
  background: #f8f9fa;
  border-left: 1px solid #dee2e6;
  height: 100vh;
  overflow-y: auto;
}

#aiInsightsPanel.d-none {
  display: none !important;
}

.insight-card h6 {
  border-bottom: 1px solid #eef1f3;
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

/* Intelligent AI Response Styles */
.intelligent-ai {
  background: transparent;
  border-left: none; /* Remove the blue border */
}

.intelligent-response {
  font-size: 0.85rem;
  line-height: 1.6;
}

.intelligent-response p {
  margin-bottom: 0.75rem;
}

.intelligent-response strong {
  color: #007bff;
  font-weight: 600;
}

.intelligent-response ul,
.intelligent-response ol {
  margin: 0.5rem 0 0.75rem 1rem;
  padding-left: 0.5rem;
}

.intelligent-response li {
  margin: 0.25rem 0;
  color: #495057;
}

.thinking-text {
  font-style: italic;
  color: #6c757d;
  font-size: 0.9rem;
  animation: pulsateText 2s ease-in-out infinite;
}

@keyframes pulsateText {
  0%, 100% {
    color: #3d1019;
  }
  50% {
    color: #4b5563;
  }
}

.thinking-text span {
  display: inline-block;
  animation: pulsateText 2s ease-in-out infinite;
}

.ai-thinking {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: transparent;
  border-radius: 8px;
  border: 1px solid transparent;
}

.thinking-spinner {
  flex-shrink: 0;
}

/* Enhanced message styling */
.message.intelligent-ai .message-content {
  background: transparent;
}

.message.intelligent-ai .message-header {
  background: rgba(0, 123, 255, 0.1);
  border-radius: 6px 6px 0 0;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.message.intelligent-ai .ai-agent {
  background: #007bff;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}



/* Responsive adjustments */
@media (max-width: 768px) {
  .ai-insights-container {
    padding: 0.5rem;
  }
  
  .insight-card {
    padding: 0.75rem;
  }
  
  .summary-meta,
  .reply-meta {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .intelligent-response {
    font-size: 0.9rem;
  }
  
  .ai-thinking {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }
}

/* Service Unavailable Styles */
.intelligent-ai.service-unavailable {
  background: linear-gradient(135deg, rgba(11, 54, 94, 0.1) 0%, rgba(11, 54, 94, 0.2) 100%);
  border-left: 4px solid #3d1019;
  box-shadow: 0 2px 8px rgba(11, 54, 94, 0.2);
}

.intelligent-ai.service-unavailable .ai-thinking {
  color: #856404;
  background: rgba(255, 193, 7, 0.1);
  border-radius: 8px;
  padding: 0.5rem;
  margin-bottom: 1rem;
}

.intelligent-ai.service-unavailable .ai-thinking i {
  color: #3d1019;
}

.intelligent-ai.service-unavailable .response-content {
  color: #856404;
}

.intelligent-ai.service-unavailable .response-content strong {
  color: #856404;
  font-weight: 700;
}

/* Enhanced Message Text Formatting */
.message-text p {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.message-text p:last-child {
  margin-bottom: 0;
}

.message-text ul,
.message-text ol {
  margin: 0.75rem 0;
  padding-left: 1.25rem;
}

.message-text li {
  margin: 0.5rem 0;
  padding-left: 0;
  line-height: 1.5;
}

.message-text strong {
  font-weight: 600;
  color: #1f2937;
}

.message-text em {
  font-style: italic;
  color: #6b7280;
}

/* Fix for escaped newlines in AI responses */
.message-text {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Ensure proper spacing for AI responses */
.ai-message-bubble .message-text {
  background-color: transparent;
  padding: 0 0 1.25rem 0.75rem;
  border-radius: 18px;
  border-top-left-radius: 4px;
  line-height: 1.6;
  color: #374151;
  font-size: 0.85rem;
  box-shadow: none;
  border: none;
}

/* List formatting in AI responses */
.message-text ul {
  list-style-type: disc;
}

.message-text ol {
  list-style-type: decimal;
}

/* Better paragraph spacing */
.message-text p + p {
  margin-top: 0.5rem;
}

/* Code blocks in AI responses */
.message-text code {
  background-color: #f3f4f6;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  color: #e11d48;
}

/* Multi-line code blocks */
.message-text pre {
  background-color: #1e1e1e;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 0.75rem 0;
  overflow-x: auto;
}

.message-text pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  color: #d4d4d4;
  font-size: 0.875rem;
  display: block;
  white-space: pre;
  line-height: 1.5;
}

/* Blockquotes in AI responses */
.message-text blockquote {
  border-left: 4px solid #e5e7eb;
  padding-left: 1rem;
  margin: 1rem 0;
  color: #6b7280;
  font-style: italic;
}

/* Remove blue line from AI responses */
.intelligent-ai {
  background: transparent;
  border-left: none; /* Remove the blue border */
}

/* Context menu styles */
.conversation-context-menu {
  position: absolute;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  min-width: 150px;
  padding: 4px 0;
}

.context-menu-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.context-menu-item:hover {
  background-color: #f3f4f6;
}

.context-menu-item.delete-item {
  color: #dc2626;
}

.context-menu-item.delete-item:hover {
  background-color: #fef2f2;
}

.context-menu-item i {
  width: 14px;
  font-size: 12px;
}

/* Matters Page Styles */
.matters-container {
  max-width: 100%;
  padding: 0;
}

.matter-card {
  transition: all 0.3s ease;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff; /* default to white */
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.matter-card:hover {
  background-color: #eef1f3; /* softer hover */
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.2) !important;
}

.assignee-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3d1019, #3d1019);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bg-gradient-primary {
  background: linear-gradient(135deg, #a32b43, #3d1019) !important;
}

.progress {
  border-radius: 4px;
  background-color: #eef1f3;
  height: 8px;
}

.progress-bar {
  border-radius: 4px;
  background: linear-gradient(135deg, #a32b43, #3d1019) !important;
}

.card {
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.badge {
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
}

/* Stats Cards */
.stats-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: all 0.3s ease;
}

.stats-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.2);
}

/* Matter Status Colors */
.badge-status-completed {
  background-color: #10b981;
  color: white;
}

.badge-status-in-progress {
  background-color: #3b82f6;
  color: white;
}

.badge-status-review {
  background-color: #3d1019;
  color: white;
}

.badge-status-planning {
  background-color: #6b7280;
  color: white;
}

/* Priority Colors */
.badge-priority-high {
  background-color: #dc2626;
  color: white;
}

.badge-priority-medium {
  background-color: #3b82f6;
  color: white;
}

.badge-priority-low {
  background-color: #6b7280;
  color: white;
}

/* Icon Backgrounds */
.icon-bg-primary {
  background-color: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.icon-bg-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.icon-bg-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: #3d1019;
}

.icon-bg-info {
  background-color: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

/* Financial Flow Palette - Semantic Colors for Matter Details Stats */
.icon-bg-financial-earned {
  background-color: #ecfdf5; /* Light green */
  color: #059669; /* Rich green - Money earned/positive */
}

.icon-bg-financial-debt {
  background-color: #fef2f2; /* Light red */
  color: #dc2626; /* Alert red - Outstanding debt/urgent */
}

.icon-bg-financial-rate {
  background-color: #fffbeb; /* Light gold */
  color: #efa24a; /* Gold - Value/premium pricing */
}

.icon-bg-financial-time {
  background-color: #dbeafe; /* Light blue */
  color: #2563eb; /* Professional blue - Time tracking/productivity */
}

/* Responsive adjustments for Matters page */
@media (max-width: 768px) {
  .matters-container {
    padding: 0;
  }
  
  .matter-card {
    margin-bottom: 1rem;
  }
  
  .assignee-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }
}

/* Animation for matter cards */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.matter-card {
  animation: fadeInUp 0.6s ease-out;
}

.matter-card:nth-child(1) { animation-delay: 0.1s; }
.matter-card:nth-child(2) { animation-delay: 0.2s; }
.matter-card:nth-child(3) { animation-delay: 0.3s; }
.matter-card:nth-child(4) { animation-delay: 0.4s; }

/* Custom Scrollbar Styling for Matters Page */
.matters-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.matters-container::-webkit-scrollbar-track {
    background: transparent;
}

.matters-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.matters-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Apply custom scrollbar to all scrollable areas within matters page */
.matters-container *::-webkit-scrollbar,
.matter-card::-webkit-scrollbar,
.card::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.matters-container *::-webkit-scrollbar-track,
.matter-card::-webkit-scrollbar-track,
.card::-webkit-scrollbar-track {
    background: transparent;
}

.matters-container *::-webkit-scrollbar-thumb,
.matter-card::-webkit-scrollbar-thumb,
.card::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.matters-container *::-webkit-scrollbar-thumb:hover,
.matter-card::-webkit-scrollbar-thumb:hover,
.card::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Custom Scrollbar for Tasks Page Inbox Container */
.inbox-container::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.inbox-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.inbox-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.inbox-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

.inbox-container::-webkit-scrollbar-button:start:increment {
  height: 1%;
  display: block;
  background: transparent;
}

.inbox-container::-webkit-scrollbar-button:end:increment {
    height: 1%;
    display: block;
    background: transparent;
}

/* Documents Page Styles */
.documents-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
}

.folder-item {
  transition: all 0.2s ease;
  cursor: pointer;
  border-radius: 8px;
}

.folder-item:hover {
  background-color: #f8f9fa;
  transform: translateX(2px);
}

.document-card {
  transition: all 0.3s ease;
  border: 1px solid #e5e7eb;
  background: #ffffff; /* default to white */
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.document-card:hover {
  background-color: #eef1f3; /* softer hover */
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.2) !important;
  border-color: #3d1019;
}

/* Document Status Colors */
.badge-status-final,
.badge-status-published,
.badge-status-active {
  background-color: #10b981;
  color: white;
}

.badge-status-draft {
  background-color: #3b82f6;
  color: white;
}

.badge-status-review {
  background-color: #3d1019;
  color: #1f2937;
}

/* Document Visibility Icons */
.visibility-public {
  color: #10b981;
}

.visibility-team {
  color: #3b82f6;
}

.visibility-private {
  color: #6b7280;
}

/* Document List Animations */
@keyframes documentFadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.document-card {
  animation: documentFadeInUp 0.6s ease-out;
}

.document-card:nth-child(1) { animation-delay: 0.1s; }
.document-card:nth-child(2) { animation-delay: 0.2s; }
.document-card:nth-child(3) { animation-delay: 0.3s; }
.document-card:nth-child(4) { animation-delay: 0.4s; }
.document-card:nth-child(5) { animation-delay: 0.5s; }

/* Document Action Buttons */
.document-actions .btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.document-actions .btn:hover {
  background-color: #f3f4f6;
  transform: scale(1.05);
}

/* Storage Progress Bar */
.storage-progress {
  height: 8px;
  border-radius: 4px;
  background-color: #eef1f3;
}

.storage-progress .progress-bar {
  background: linear-gradient(135deg, #0078d4, #0078d4) !important;
  border-radius: 4px;
}

/* Folder Icons */
.folder-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Document Icons */
.document-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tag Styling */
.document-tag {
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Responsive adjustments for Documents page */
@media (max-width: 768px) {
  .documents-container {
    padding: 0;
  }
  
  .document-card {
    margin-bottom: 1rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }
  
  .d-flex.gap-4 {
    gap: 1rem !important;
  }
  
  .document-actions {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .document-actions .btn {
    width: 28px;
    height: 28px;
  }
}

/* Search Input Styling */
.document-search {
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.document-search:focus {
  border-color: #3d1019;
  box-shadow: 0 0 0 3px rgba(11, 54, 94, 0.1);
  outline: none;
}

/* Filter Button Styling */
.filter-btn {
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background-color: #f8f9fa;
  border-color: #d1d5db;
}

/* Upload Button Styling */
.upload-btn {
  background: linear-gradient(135deg, #3d1019, #3d1019);
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  color: white;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(11, 54, 94, 0.3);
}

.upload-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(11, 54, 94, 0.4);
  color: white;
}

/* Additional Document Styles */
.min-width-0 {
  min-width: 0;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Document Card Animations */
@keyframes documentFadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.document-card {
  animation: documentFadeInUp 0.6s ease-out;
}

.document-card:nth-child(1) { animation-delay: 0.1s; }
.document-card:nth-child(2) { animation-delay: 0.2s; }
.document-card:nth-child(3) { animation-delay: 0.3s; }
.document-card:nth-child(4) { animation-delay: 0.4s; }

/* -------------------------------------------------------
   Matters Page – match Documents/Teams card interactions
   (scoped so only Matters page cards are affected)
-------------------------------------------------------- */
.matters-container .card,
.matters-container .matter-card,
.matters-container .stats-card {
  transition: all 0.3s ease;
  background: #ffffff; /* default to white */
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.matters-container .card:hover,
.matters-container .matter-card:hover,
.matters-container .stats-card:hover {
  background-color: #eef1f3; /* softer hover */
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.2) !important;
  border-color: #3d1019;
}

/* Apply same fade-in animation used for document cards */
.matters-container .card,
.matters-container .matter-card,
.matters-container .stats-card {
  animation: fadeInUp 0.6s ease-out;
}
.document-card:nth-child(5) { animation-delay: 0.5s; }

  /* -------------------------------------------------------
     Client Dashboard – apply document-card fade-in to cards
     (gd-card general cards, qa-card quick access tiles)
  -------------------------------------------------------- */
  .global-dashboard-main .gd-card,
  .global-dashboard-main .qa-card {
    animation: documentFadeInUp 0.6s ease-out;
  }

/* Global Layout with Chat Panel */
body {
  margin: 0;
  padding: 0;
  background: #C7B7A333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.min-h-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Main content area adjustment for chat panel */
.main-content {
  margin-left: 0;
  padding-left: 0;
  min-height: 100vh;
  background-color: #ffffff;
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: 12px 0 0 0; /* Rounded corners on top-left and top-right */
}

@media (min-width: 992px) {
  .main-content {
    /* margin-left: 14vw; */
    padding-left: 0;
    min-height: 100vh;
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
    transition: margin-right 0.2s ease;
  }
}

.resize-handle {
  width: 8px;
  background: transparent;
  cursor: col-resize;
  position: fixed;
  top: 7vh; /* Start below header */
  right: calc(320px - 12px); /* Left edge aligns with main content right edge */
  height: calc(100vh - 7.75vh);
  z-index: 9999; /* Above everything including sidebars */
  border-radius: 4px;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.resize-handle:hover {
  background: linear-gradient(to bottom, transparent 0%, transparent 1%, rgba(61, 16, 25, 0.05) 1%, rgba(61, 16, 25, 0.05) 100%);
}

.resize-handle:active {
  background: rgba(61, 16, 25, 0.1);
}

.resize-handle::before {
  content: '';
  position: absolute;
  width: 3px;
  height: 24px;
  background: #9ca3af;
  border-radius: 2px;
  opacity: 1;
  pointer-events: none;
}

.resize-handle:hover::before {
  opacity: 1;
  background: #6b7280;
}

.resize-handle:active::before {
  background: #374151;
}



.chat-panel-header {
  background-color: transparent; /* Transparent background */
  padding: 0.75rem 0.5rem;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(11, 54, 94, 0.1);
}

/* Chat tabs container positioned at the very top, spanning full width */
.chat-tabs-container {
  padding: 0.25rem 1rem 0rem 1rem; /* Reduced padding - extra right for scrollbar */
  border-bottom: none;
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
}

.conversation-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  width: 100%;
  margin: 0;
}

.tab-list {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  min-width: 0;
  width: 100%;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  position: relative;
  z-index: 1;
  align-items: center;
}

.tab-list::-webkit-scrollbar {
  display: none;
}

.tab-list:active {
  cursor: grabbing;
}

/* Ensure the tab list can be scrolled */
.tab-list {
  scroll-snap-type: x mandatory;
}

.conversation-tab {
  scroll-snap-align: start;
}

.conversation-tab {
  display: flex;
  align-items: center;
  gap: 0.25rem; /* Reduced gap for more title space */
  padding: 0.5rem 0.35rem 0.5rem 0.75rem; /* Minimal right padding */
  background-color: rgba(61, 16, 25, 0.05);
  border: none;
  border-radius: 16px; /* Pill shape */
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: 100px;
  max-width: 180px;
  position: relative;
  overflow: hidden;
  color: #3d1019;
  font-size: 0.875rem;
}

.conversation-tab .tab-title {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: all 0.2s ease;
  min-width: 0;
  position: relative;
}

.conversation-tab .tab-close {
  opacity: 0;
  transition: all 0.2s ease;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%; /* Circular close button */
  background: rgba(61, 16, 25, 0.2);
  border: none;
  cursor: pointer;
  color: #3d1019;
  font-size: 10px;
  flex-shrink: 0;
  margin-left: 4rem;
  position: absolute;
}

.conversation-tab:hover:not(.active) {
  background-color: rgba(61, 16, 25, 0.1);
  color: #3d1019;
}

.conversation-tab.active:hover {
  background-color: #3d1019;
  color: white;
}

.conversation-tab:hover .tab-title {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  color: inherit;
}

.conversation-tab.active:hover .tab-close {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.conversation-tab.active {
  background-color: #3d1019;
  color: white;
  font-weight: 500;
}

.conversation-tab.active .tab-close {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.conversation-tab.active:hover .tab-close {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.tab-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.875rem;
  font-weight: 500;
}

.conversation-tab:not(.active):hover .tab-close {
  opacity: 1;
  background: rgba(61, 16, 25, 0.2);
  color: #3d1019;
}

.conversation-tab:not(.active) .tab-close:hover {
  background-color: #3d1019;
  color: white;
}

.conversation-tab.active .tab-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.new-conversation-btn {
  background-color: #3d1019;
  border-color: #3d1019;
  color: white;
  border-radius: 20px; /* Pill shape to match tabs */
  padding: 0.5rem 0.75rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.new-conversation-btn:hover {
  background-color: #3d1019;
  border-color: #3d1019;
  color: white;
}

.chat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0; /* Remove padding since tabs are now inside */
  margin-top: 0; /* Ensure no top margin */
  position: relative; /* For sticky message overlay positioning */
}

/* Mobile responsiveness for chat layout */
@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }
  
  .resize-handle {
    display: none;
  }
  
  .chat-panel {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    border-left: none;
    box-shadow: none;
    position: relative;
    height: auto;
    min-height: 100vh;
  }
  
  .conversation-tabs {
    flex-wrap: wrap;
  }
  
  .tab-list {
    flex-wrap: wrap;
  }
  
  .conversation-tab {
    min-width: 100px;
    max-width: 150px;
  }
}

@media (max-width: 991.98px) {
  .main-content {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }
  
  .chat-panel {
    position: relative;
    height: auto;
    min-height: 100vh;
  }
  
  .resize-handle {
    display: none;
  }
}

/* Sidebar Navigation Styles */

.bg-gradient-subtle {
  background: linear-gradient(135deg, #ffffff 0%, #eee9e9 100%);
}

.sidebar-desktop {
  width: 240px;
  max-width: 240px;
  min-width: 240px;
  z-index: 50;
  background-color: #ffffff;
  border-right: 1px solid #e5e7eb;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
  overflow: visible;
}

.shadow-soft {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.bg-gradient-primary {
  background: linear-gradient(135deg, #3d1019, #3d1019);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-xl {
  font-size: 1.25rem;
  line-height: 1.75rem;
}

.transition-smooth {
  transition: all 0.2s ease-in-out;
}

.bg-accent {
  background-color: rgba(11, 54, 94, 0.1);
}

.text-accent-foreground {
  color: #3d1019;
}

.hover-text-foreground:hover {
  color: #1f2937;
}

.hover-bg-secondary:hover {
  background-color: #f3f4f6;
}


/* Mobile sidebar styles */
.btn-ghost {
  background: none;
  border: none;
  color: #6b7280;
}

.btn-ghost:hover {
  background-color: #f3f4f6;
  color: #1f2937;
}

/* Active state for navigation items */
.nav-link.bg-accent {
  background-color: rgba(11, 54, 94, 0.1) !important;
  color: #3d1019 !important;
}

.nav-link.text-muted-foreground {
  color: #6b7280 !important;
}

.nav-link:hover {
  background-color: #f3f4f6;
  color: #1f2937;
}

/* Ensure proper active state styling */
.nav-link.bg-accent i {
  color: #3d1019 !important;
}

.nav-link.text-muted-foreground i {
  color: #6b7280 !important;
}

.nav-link:hover i {
  color: #3d1019;
}

/* Scale icon styling */
.fas.fa-balance-scale {
  color: #3d1019;
}

/* Ensure proper text styling for sidebar */
.text-xl {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 600;
}

/* Ensure proper spacing for navigation items */
.nav-link {
  padding: 0.75rem 1rem;
  margin-bottom: 0.25rem;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
  display: flex;
  align-items: center;
  text-decoration: none;
}

/* Global nav link styling - separate from regular nav-link */
.global-nav-link {
  padding: 0.75rem 1rem;
  margin-bottom: 0.25rem;
  border-radius: 8px;
  font-weight: 500;
  display: flex;
  align-items: center;
  text-decoration: none;
}

.global-nav-link:hover {
  background-color: #f3f4f6;
  color: #1f2937;
}

/* Ensure proper hover states */
.nav-link:hover {
  background-color: #f3f4f6;
  color: #1f2937;
  transform: translateX(2px);
}

/* Ensure proper active states */
.nav-link.bg-accent {
  background-color: rgba(11, 54, 94, 0.1) !important;
  color: #3d1019 !important;
  font-weight: 600;
}

/* Ensure proper icon spacing */
.nav-link i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Ensure proper text spacing */
.nav-link span {
  flex: 1;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* Responsive adjustments for sidebar */
@media (max-width: 991.98px) {
  .sidebar-desktop {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0;
    padding-left: 0;
  }
  
  .px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .py-8 {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
}

/* Offcanvas mobile sidebar */
.offcanvas {
  width: 280px;
}

.offcanvas-header {
  border-bottom: 1px solid #e5e7eb;
  padding: 1rem 1.5rem;
}

.offcanvas-body {
  padding: 0;
}

/* Navigation item spacing */
.nav-link {
  margin-bottom: 0.25rem;
  border-radius: 8px;
  font-weight: 500;
}

.nav-link i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

/* Sidebar navigation list styling */
.list-unstyled {
  padding-left: 0;
  margin-bottom: 0;
}

.list-unstyled li {
  margin-bottom: 0.25rem;
}

/* Ensure proper spacing for navigation items */
.gap-2 > * + * {
  margin-top: 0.5rem;
}

/* Logo section styling */
.py-4 {
  padding-top: 0rem;
  padding-bottom: 0rem;
}

/* Ensure proper spacing for main content */
.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.py-8 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

@media (min-width: 992px) {
  .px-4 {
    padding-left: 2rem;
    padding-right: 2rem;
  }
  
  .py-8 {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
}

/* Ensure main content is properly positioned */
.main-content .px-4 {
  width: 100%;
  background-color: #ffffff;
  position: relative;
  z-index: 1;
}

/* Additional sidebar styling to match design */
.sidebar-desktop .d-flex.flex-column {
  height: 100vh;
  max-height: 100vh;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

/* Navigation area should not scroll - fit to screen */
.sidebar-desktop nav {
  flex: 1;
  overflow: visible;
  min-height: 0;
}

/* Ensure navigation items display properly without cutoff */
.sidebar-desktop .nav-link {
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
  width: 100%;
  min-width: 0;
}

/* Scrollbar removed since sidebar should not scroll */

/* Ensure proper logo section styling */
.sidebar-desktop .py-4 {
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 1.5rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

/* Navigation link styling improvements */
.sidebar-desktop .nav-link {
  margin-bottom: 0.5rem;
  border-radius: 12px;
  transition: all 0.3s ease;
  position: relative;
  overflow: visible;
  padding: 0.75rem 0.75rem !important;
  margin-left: -0.5rem;
  margin-right: 0.5rem;
  width: calc(100% + 0.5rem);
}

.sidebar-desktop .nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #3d1019, #3d1019);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 12px;
}

.sidebar-desktop .nav-link:hover::before {
  opacity: 0.1;
}

.sidebar-desktop .nav-link.bg-accent::before {
  opacity: 1;
}

.sidebar-desktop .nav-link .fas,
.sidebar-desktop .nav-link span {
  position: relative;
  z-index: 1;
}

.sidebar-desktop .nav-link:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(11, 54, 94, 0.15);
}

.sidebar-desktop .nav-link.bg-accent {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(11, 54, 94, 0.25);
}

.sidebar-desktop .nav-link i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

/* Ensure proper logo text styling */
.sidebar-desktop .text-xl {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 600;
  color: #1f2937;
}

/* Ensure proper logo icon styling */
.sidebar-desktop .fas.fa-balance-scale {
  color: #3d1019;
  font-size: 2rem;
}

/* Missing utility classes for sidebar navigation */
.bg-accent {
  background-color: #3d1019 !important;
}

.text-accent-foreground {
  color: #ffffff !important;
}

.bg-accent .fas,
.bg-accent .fw-medium,
.bg-accent i,
.bg-accent span {
  color: #ffffff !important;
}

/* More specific targeting for selected nav items */
.sidebar-desktop .nav-link.bg-accent .fas,
.sidebar-desktop .nav-link.bg-accent .fw-medium,
.sidebar-desktop .nav-link.bg-accent i,
.sidebar-desktop .nav-link.bg-accent span {
  color: #ffffff !important;
}

.offcanvas-body .nav-link.bg-accent .fas,
.offcanvas-body .nav-link.bg-accent .fw-medium,
.offcanvas-body .nav-link.bg-accent i,
.offcanvas-body .nav-link.bg-accent span {
  color: #ffffff !important;
}

.bg-gradient-primary {
  background: linear-gradient(135deg, #a32b43, #3d1019) !important;
}

.bg-clip-text {
  -webkit-background-clip: text;
  background-clip: text;
}

.text-transparent {
  color: transparent !important;
}

.shadow-soft {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.transition-smooth {
  transition: all 0.3s ease !important;
}

.text-muted-foreground {
  color: #6b7280 !important;
}

.hover-text-foreground:hover {
  color: #1f2937 !important;
}

.hover-bg-secondary:hover {
  background-color: #f3f4f6 !important;
}

.text-xl {
  font-size: 1.5rem;
  line-height: 2rem;
}

.fw-semibold {
  font-weight: 600 !important;
}

.fw-medium {
  font-weight: 500 !important;
}

.rounded-3 {
  border-radius: 0.75rem !important;
}

.gap-2 {
  gap: 0.5rem !important;
}

.gap-3 {
  gap: 0.75rem !important;
}

.p-3 {
  padding: 0.75rem !important;
}

.py-4 {
  padding-top: 1rem !important;
  padding-bottom: 1rem !important;
}

.px-4 {
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

.py-8 {
  padding-top: 1rem !important;
  padding-bottom: 1rem !important;
}

.px-8 {
  padding-left: 2rem !important;
  padding-right: 2rem !important;
}


.h-100 {
  height: 100% !important;
}

.fixed {
  position: fixed !important;
}

.top-0 {
  top: 0 !important;
}

.start-0 {
  left: 0 !important;
}

.d-flex {
  display: flex !important;
}

.flex-column {
  flex-direction: column !important;
}

.flex-fill {
  flex: 1 1 auto !important;
}

.align-items-center {
  align-items: center !important;
}

.justify-content-between {
  justify-content: space-between !important;
}

.overflow-y-auto {
  overflow-y: auto !important;
}

.list-unstyled {
  list-style: none !important;
  padding-left: 0 !important;
}

.text-decoration-none {
  text-decoration: none !important;
}

.fs-5 {
  font-size: 1.25rem !important;
}

.fs-4 {
  font-size: 1.5rem !important;
}

.btn-ghost {
  background-color: transparent !important;
  border: none !important;
  color: #6b7280 !important;
}

.btn-ghost:hover {
  background-color: #f3f4f6 !important;
  color: #1f2937 !important;
}

.text-sm {
  font-size: 0.875rem !important;
}

.offcanvas {
  position: fixed !important;
  bottom: 0 !important;
  z-index: 1045 !important;
  display: flex !important;
  flex-direction: column !important;
  max-width: 100% !important;
  visibility: hidden !important;
  background-color: #fff !important;
  background-clip: padding-box !important;
  outline: 0 !important;
  transition: transform 0.3s ease-in-out !important;
}

.offcanvas-start {
  top: 0 !important;
  left: 0 !important;
  width: 400px !important;
  border-right: 1px solid rgba(0, 0, 0, 0.2) !important;
  transform: translateX(-100%) !important;
}

.offcanvas-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 1rem !important;
  border-bottom: 1px solid #dee2e6 !important;
}

.offcanvas-body {
  flex-grow: 1 !important;
  padding: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

.offcanvas-body nav {
  flex: 1;
  overflow: visible;
  min-height: 0;
  padding: 1rem 0.75rem;
}

.btn-close {
  box-sizing: content-box !important;
  width: 1em !important;
  height: 1em !important;
  padding: 0.25em 0.25em !important;
  color: #000 !important;
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='m.5 3.5 3 3-3 3 1 1 3-3 3 3 1-1-3-3 3-3-1-1-3 3-3-3z'/%3e%3c/svg%3e") center/1em auto no-repeat !important;
  border: 0 !important;
  border-radius: 0.375rem !important;
  opacity: 0.5 !important;
}

.btn-close:hover {
  color: #000 !important;
  text-decoration: none !important;
  opacity: 0.75 !important;
}

.btn-close:focus {
  outline: 0 !important;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
  opacity: 1 !important;
}

/* Documents page specific styling - removed duplicate rule */

.document-search {
  border-radius: 8px;
  border: 1px solid #d1d5db;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.document-search:focus {
  border-color: #3d1019;
  box-shadow: 0 0 0 3px rgba(11, 54, 94, 0.1);
  outline: none;
}

.filter-btn {
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  color: #6b7280;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background-color: #f9fafb;
  border-color: #3d1019;
  color: #3d1019;
}

.upload-btn {
  background: linear-gradient(135deg, #3d1019, #3d1019);
  border: none;
  color: white;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.upload-btn:hover {
  background: linear-gradient(135deg, #3d1019, #3d1019);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.folder-item {
  transition: all 0.2s ease;
  cursor: pointer;
}

.folder-item:hover {
  background-color: #f9fafb;
  transform: translateY(-1px);
}

.document-card {
  transition: all 0.3s ease;
  border-radius: 12px;
}

.document-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
}

.document-tag {
  background-color: #f3f4f6;
  color: #374151;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.document-actions .btn {
  border-radius: 6px;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.document-actions .btn:hover {
  background-color: #f3f4f6;
  border-color: #d1d5db;
}

.storage-progress {
  height: 8px;
  border-radius: 4px;
  background-color: #e5e7eb;
}

.storage-progress .progress-bar {
  background: linear-gradient(135deg, #0078d4, #0078d4);
  border-radius: 4px;
}

/* Mobile header styling */
.d-lg-none .sticky-top {
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Offcanvas mobile sidebar styling */
.offcanvas {
  background-color: #ffffff;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.1);
}

.offcanvas-start {
  border-right: 1px solid #e5e7eb;
}

.offcanvas-header {
  background: linear-gradient(135deg, #ffffff, #eee9e9);
  border-bottom: 1px solid #e5e7eb;
}

.offcanvas-body .nav-link {
  margin-bottom: 0.5rem;
  border-radius: 12px;
  transition: all 0.3s ease;
  position: relative;
  overflow: visible;
  margin-left: -0.5rem;
  margin-right: 0.5rem;
  width: calc(100% + 0.5rem);
}

.offcanvas-body .nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #3d1019, #3d1019);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 12px;
}

.offcanvas-body .nav-link:hover::before {
  opacity: 0.1;
}

.offcanvas-body .nav-link.bg-accent::before {
  opacity: 1;
}

.offcanvas-body .nav-link .fas,
.offcanvas-body .nav-link span {
  position: relative;
  z-index: 1;
}

.offcanvas-body .nav-link:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(11, 54, 94, 0.15);
}

.offcanvas-body .nav-link.bg-accent {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(11, 54, 94, 0.25);
}

.offcanvas-body .nav-link i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

/* Logout button styling */
.sidebar-desktop .logout-button,
.offcanvas-body .logout-button {
  border: none !important;
  background: transparent !important;
  width: calc(100% + 0.5rem);
  text-align: left;
  cursor: pointer;
  padding: 0.75rem 0.75rem !important;
  margin-left: -0.5rem;
  margin-right: 0.5rem;
}

.sidebar-desktop .logout-button:hover,
.offcanvas-body .logout-button:hover {
  background-color: #f3f4f6 !important;
  color: #1f2937 !important;
}

.sidebar-desktop .logout-button i,
.offcanvas-body .logout-button i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

/* Ensure logout button area is always visible */
.sidebar-desktop .mt-auto {
  flex-shrink: 0;
  margin-top: auto;
}

/* Ensure proper spacing for logout area */
.sidebar-desktop .border-top {
  border-top: 1px solid #e5e7eb !important;
  padding-top: 0.75rem;
}

/* Services Page Styles - Discord-like Interface */
.communications-container {
  height: calc(100vh - 7vh);
  max-height: calc(100vh - 7vh);
  background: rgba(248, 250, 252, 0.2);
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  will-change: transform;
  transform: translateZ(0);
}

/* Override main content padding for communications page */
body.communications-page .main-content .px-4 {
  padding: 0 !important;
  height: 100vh;
  min-height: 100vh;
}

/* Remove padding from main-content itself for communications page */
body.communications-page .main-content {
  padding: 0 !important;
  height: calc(100vh - 7vh);
  max-height: calc(100vh - 7vh);
  margin: 0 !important;
  overflow: hidden;
}

/* Ensure main-content wrapper is properly sized for communications page */
body.communications-page .client-main-content-wrapper {
  height: calc(100vh - 7vh);
  max-height: calc(100vh - 7vh);
  overflow: hidden;
}

/* Hide footer on communications page to prevent scrolling */
body.communications-page .footer {
  display: none !important;
}

/* Ensure communications page body takes full height */
body.communications-page {
  height: 100vh;
  overflow: hidden;
}

/* Adjust communications container when chat panel is visible */
body.communications-page .communications-container {
  height: calc(100vh - 7vh);
  max-height: calc(100vh - 7vh);
  margin-right: 0; /* Remove any right margin to accommodate chat panel */
}

/* Ensure communications layout works with chat panel */
body.communications-page .communications-layout {
  height: calc(100vh - 7vh);
  max-height: calc(100vh - 7vh);
}

.communications-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 7vh);
  max-height: calc(100vh - 7vh);
}

/* Sidebar Styles */
.communications-sidebar {
  width: 16rem;
  background: rgba(248, 250, 252, 0.95);
  border-right: 1px solid rgba(229, 231, 235, 0.5);
  display: flex;
  flex-direction: column;
  height: 100%;
  will-change: transform;
  transform: translateZ(0);
  transition: transform 0.3s ease;
}

.communications-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(229, 231, 235, 0.5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.communications-title {
  font-weight: 700;
  color: black;
  margin: 0;
  font-size: 1.25rem;
}

.communications-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0.25rem 0 0 0;
}

/* Channels Section */
.channels-section {
  flex: 1;
  padding: 0.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.channel-category {
  margin-bottom: 1rem;
}

.category-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  padding-left: 0;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.category-toggle:hover {
  color: #1f2937;
}

.category-icon {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.channels-list {
  margin-top: 0.25rem;
  display: block;
  max-height: 5000px;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  opacity: 1;
}

.channels-list.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.channel-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 1.5rem;
  margin: 0.125rem 0;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.channel-item:hover {
  background: rgba(156, 163, 175, 0.2);
  color: #1f2937;
}

.channel-item.active {
  background: rgba(59, 130, 246, 0.3);
  color: #1f2937;
}

.channel-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.channel-icon {
  font-size: 1rem;
  color: #6b7280;
  flex-shrink: 0;
}

.channel-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-meta {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.voice-users {
  display: flex;
  gap: -0.25rem;
}

.voice-user-avatar {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  font-weight: 600;
  border: 1px solid #f3f4f6;
  margin-left: -0.25rem;
}

.unread-badge {
  background: #ef4444;
  color: white;
  font-size: 0.75rem;
  padding: 2px;
  border-radius: 50%;
  font-weight: 600;
  min-width: 1.25rem;
  min-height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  aspect-ratio: 1;
}

/* Subcategory Styles */
.subcategory-section {
  margin-bottom: 0.5rem;
}

.subcategory-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  padding-left: 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.subcategory-toggle:hover {
  color: #1f2937;
}

.subcategory-icon {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.subcategory-channels {
  margin-top: 0.25rem;
  display: block;
  max-height: 5000px;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  opacity: 1;
}

.subcategory-channels.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.subcategory-channels .channel-item {
  padding-left: 2rem;
}

/* User Panel */
.user-panel {
  padding: 0.25rem;
  border-top: 1px solid rgba(229, 231, 235, 0.5);
  background: #eef1f3;
  border-radius: 12px;
  margin: 0.25rem 0.5rem 1rem 0.5rem;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 0.375rem;
  background: rgba(248, 250, 252, 0.4);
}

.user-avatar {
  position: relative;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #a32b43, #3d1019);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.status-indicator {
  position: absolute;
  bottom: -0.125rem;
  right: -0.125rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: 2px solid #f3f4f6;
}

.status-indicator.online {
  background: #10b981;
}

.status-indicator.away {
  background: #3d1019;
}

.status-indicator.offline {
  background: #6b7280;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.user-status {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-controls {
  display: flex;
  gap: 0.25rem;
}

.control-btn {
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  background: none;
  color: #6b7280;
  cursor: pointer;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: rgba(156, 163, 175, 0.1);
  color: #1f2937;
}

/* Team Section - Now integrated into channels-section */

.team-title {
  padding-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-top: 1px solid rgba(229, 231, 235, 0.5);
}

.team-members {
  flex: 1;
  overflow-y: visible;
}

.team-member {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.team-member:hover {
  background: rgba(156, 163, 175, 0.1);
}

.member-avatar {
  position: relative;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #3d1019;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

/* Current user gets the linear gradient */
.team-member[data-user-id] .member-avatar.current-user-avatar {
  background: linear-gradient(135deg, #a32b43, #3d1019);
  font-size: 0.875rem;
}

/* External/Guest users get gray background */
.team-member[data-is-external="true"] .member-avatar,
.team-member .member-avatar.external-user-avatar,
.team-member .member-avatar.external-contacts-avatar {
  background: #aaaaaa !important; /* Lighter gray background for external users */
}

/* Pulse animation for new items */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.member-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-activity {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Services Page - Main Chat Area */
.communications-container .main-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.8);
  min-height: 0;
  height: 100%;
  position: relative;
  will-change: transform;
  transform: translateZ(0);
  transition: transform 0.3s ease;
}

/* Services Page - Chat Header */
.communications-container .chat-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(229, 231, 235, 0.5);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  will-change: transform;
  transform: translateZ(0);
  transition: transform 0.3s ease;
}

.communications-container .chat-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.channel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.channel-header-icon {
  font-size: 1.25rem;
  color: #6b7280;
}

.channel-details h2 {
  font-weight: 700;
  color: #1f2937;
  margin: 0;
  font-size: 1.25rem;
}

.channel-description {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

.chat-controls {
  display: flex;
  gap: 0.5rem;
}

/* Services Page - Messages Container */
.communications-container .messages-container {
  flex: 1;
  padding: 0 1rem;
  overflow-y: auto;
  min-height: 0;
  max-height: 100%;
  position: relative;
}

.communications-container .messages-container .messages-list {
  position: relative;
  min-height: 100%;
}

/* Services Page - Messages List */
.communications-container .messages-list {
  padding: 1rem 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Ensure messages container has proper scrolling behavior */
.communications-container .messages-container::-webkit-scrollbar {
  width: 6px;
}

.communications-container .messages-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.communications-container .messages-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.communications-container .messages-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.5);
}

/* Apply same scrollbar styling to channels sidebar */
.channels-section::-webkit-scrollbar {
  width: 5px;
}

.channels-section::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.channels-section::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.channels-section::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.5);
}

/* Scroll to bottom button */
.communications-container .scroll-to-bottom-btn {
  position: absolute;
  bottom: 6rem;
  right: 1.8rem;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: #9d5252;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  opacity: 0;
  visibility: hidden;
  z-index: 10;
}

.communications-container .scroll-to-bottom-btn:hover {
  background: #914040;
  transform: translateY(-2px);
  box-shadow: 0 6px 8px -1px rgba(0, 0, 0, 0.15);
}

.communications-container .scroll-to-bottom-btn.show {
  opacity: 1;
  visibility: visible;
}

.communications-container .scroll-to-bottom-btn i {
  font-size: 0.875rem;
}

.communications-container .message-item {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.25rem 0;
  transition: all 0.2s ease;
  max-width: fit-content;
}

.communications-container .message-item:hover {
  background: rgba(156, 163, 175, 0.05);
}

.communications-container .message-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #3d1019;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

/* Current user's message avatar gets the linear gradient */
.communications-container .message-item.current-user-message .message-avatar {
  background: linear-gradient(135deg, #a32b43, #3d1019);
}

/* Current user messages are right-aligned */
.communications-container .message-item.current-user-message {
  flex-direction: row-reverse;
  margin-left: auto;
  max-width: 95%;
}

.communications-container .message-item.current-user-message .message-avatar {
  margin-right: 0;
  margin-left: 0.75rem;
}

/* Current user message content alignment */
.communications-container .message-item.current-user-message .message-header {
  justify-content: flex-end;
}

.communications-container .message-item.current-user-message .message-text {
  text-align: left;
  padding: 0;
}

.communications-container .message-item.current-user-message .message-author {
  font-weight: 700;
  color: #3d1019;
}

.communications-container .message-item.current-user-message .message-content {
  background: rgba(61, 16, 25, 0.05);
}

/* Grouped messages (consecutive messages from same user) */
.communications-container .message-item.grouped-message {
  margin-top: 0;
  padding-top: 0;
  margin-bottom: 0.25rem;
}

.communications-container .message-item.grouped-message .message-avatar {
  visibility: hidden;
}

.communications-container .message-item.grouped-message .message-header {
  display: none;
}

/* Hover timestamp for grouped messages */
.communications-container .message-item.grouped-message .hover-timestamp {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: #6b7280;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}

.communications-container .message-item.grouped-message:hover .hover-timestamp {
  opacity: 1;
}

/* Position hover timestamp for regular (left-aligned) messages */
.communications-container .message-item.grouped-message .hover-timestamp {
  left: 0;
}

/* Position hover timestamp for current user (right-aligned) messages */
.communications-container .message-item.grouped-message.current-user-message .hover-timestamp {
  left: auto;
  right: 0;
}

/* Make grouped messages position relative for absolute positioning of timestamp */
.communications-container .message-item.grouped-message {
  position: relative;
}

.communications-container .message-content {
  flex: 1;
  min-width: 0;
  max-width: 28rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

.communications-container .message-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.communications-container .message-author {
  font-weight: 700;
  color: #1f2937;
  font-size: 0.875rem;
}

.communications-container .message-time {
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 500;
}

.communications-container .message-text {
  font-size: 0.875rem;
  color: rgba(31, 41, 55, 0.9);
  line-height: 1.5;
  margin: 0;
  white-space: pre-wrap;
  padding: 0;
}

/* Services Page - Message Reactions */
.communications-container .message-reactions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.communications-container .reaction-btn {
  height: 1.5rem;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  background: rgba(156, 163, 175, 0.1);
  border: 1px solid rgba(229, 231, 235, 0.5);
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.communications-container .reaction-btn:hover {
  background: rgba(156, 163, 175, 0.2);
}

.communications-container .add-reaction-btn {
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s ease;
}

.communications-container .message-item:hover .add-reaction-btn {
  opacity: 1;
}

.communications-container .add-reaction-btn:hover {
  background: rgba(156, 163, 175, 0.1);
  color: #1f2937;
}

/* Services Page - Message Input */
.communications-container .message-input-container {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.9);
  will-change: transform;
  transform: translateZ(0);
  transition: transform 0.3s ease;
}

/* Settings Page Styles */
.settings-container {
  max-width: 1200px;
  margin: 0 auto;
}

.settings-header {
  margin-bottom: 2rem;
}

.settings-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

.settings-subtitle {
  color: #6b7280;
  font-size: 1rem;
  margin: 0.5rem 0 0 0;
}

.settings-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  min-height: 600px;
}

.settings-sidebar {
  background: transparent;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  height: fit-content;
  position: sticky;
  top: 2rem;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  color: #6b7280;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  position: relative;
}

.settings-nav-item:hover {
  background-color: #f3f4f6;
  color: #1f2937;
  text-decoration: none;
}

.settings-nav-item.active {
  background-color: #3d1019;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(11, 54, 94, 0.2);
}

.settings-nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.settings-content {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.settings-content-inner {
  padding: 0 2rem 2rem 2rem;
  max-width: 100%;
  width: 50rem;
}

.settings-tab-content {
  display: none;
}

.settings-tab-content.active {
  display: block;
  width: 100%;
}

.settings-section {
  margin-bottom: 2rem;
  margin-top: 0.5rem;
  width: 100%;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section-header {
  margin-bottom: 1.5rem;
  max-width: 800px;
}

.settings-section-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 0.5rem 0;
}

.settings-section-header p {
  color: #6b7280;
  font-size: 0.875rem;
  margin: 0;
}

.settings-section-content {
  background: #f9fafb;
  border-radius: 8px;
  padding: 1.5rem;
  border: 1px solid #e5e7eb;
  width: 100%;
  max-width: 800px;
  box-sizing: border-box;
}

.settings-row {
  display: grid;
  grid-template-columns: 1fr auto; /* content | action */
  align-items: center;
  column-gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.settings-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.settings-row:first-child {
  padding-top: 0;
}

.settings-row-content {
  min-width: 0;
}

/* Ensure actions (buttons/switches) align consistently */
.settings-row > :last-child {
  justify-self: end;
}

.settings-row-label {
  font-weight: 500;
  color: #1f2937;
  margin: 0 0 0.25rem 0;
  font-size: 0.875rem;
}

.settings-row-description {
  color: #6b7280;
  font-size: 0.75rem;
  margin: 0;
}

.settings-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 1.5rem 0;
}

/* Form controls in Settings pages - match login/register styling */
.settings-container .form-control,
.settings-container .form-select,
.settings-container textarea.form-control {
  border: 1px solid rgba(61, 16, 25, 0.08);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  background-color: #ffffff !important;
  color: #374151 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}

.settings-container .form-control:focus,
.settings-container .form-select:focus,
.settings-container textarea.form-control:focus {
  border-color: rgba(61, 16, 25, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
  outline: none;
}

.settings-container .form-control:-webkit-autofill,
.settings-container .form-control:-webkit-autofill:hover,
.settings-container .form-control:-webkit-autofill:focus,
.settings-container .form-select:-webkit-autofill,
.settings-container .form-select:-webkit-autofill:hover,
.settings-container .form-select:-webkit-autofill:focus,
.settings-container textarea.form-control:-webkit-autofill,
.settings-container textarea.form-control:-webkit-autofill:hover,
.settings-container textarea.form-control:-webkit-autofill:focus {
  -webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18), 0 0 0 30px #ffffff inset !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18) !important;
  border-color: rgba(61, 16, 25, 0.08) !important;
  -webkit-text-fill-color: #374151 !important;
}

.settings-container .form-control:-webkit-autofill:focus,
.settings-container .form-select:-webkit-autofill:focus,
.settings-container textarea.form-control:-webkit-autofill:focus {
  -webkit-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28), 0 0 0 30px #ffffff inset !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28) !important;
}

.settings-container .form-control::placeholder {
  color: #9ca3af;
}

.settings-container .form-control[readonly] {
  background-color: #f9fafb !important;
  cursor: default;
}

.settings-container .form-label {
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.settings-container .form-group {
  margin-bottom: 1.5rem;
}

/* Fix Bootstrap row negative margins within settings */
.settings-section-content > .row {
  margin-left: 0;
  margin-right: 0;
}

.settings-section-content > .row > [class*="col-"] {
  padding-left: 0;
  padding-right: 12px;
}

.settings-section-content > .row > [class*="col-"]:last-child {
  padding-right: 0;
}

/* Profile Avatar Section */
.profile-avatar-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.profile-avatar {
  flex-shrink: 0;
}

.avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3d1019, #3d1019);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 600;
}

.avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.avatar-hint {
  color: #6b7280;
  font-size: 0.75rem;
  margin: 0;
}

/* Organization Logo */
.org-logo-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3d1019, #3d1019);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 2px 8px rgba(11, 54, 94, 0.2);
}

/* Session List */
.session-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.session-item {
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
}

.session-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.session-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #f3f4f6;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.session-details {
  flex: 1;
  min-width: 0;
}

.session-device {
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 0.25rem 0;
  font-size: 0.875rem;
}

.session-metadata {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.3;
}

.session-placeholder {
  border-style: dashed;
  border-color: #d1d5db;
  background: #f9fafb;
}

.session-location {
  color: #6b7280;
  font-size: 0.875rem;
  margin: 0;
}

/* Form Controls */
.form-check-input:checked {
  background-color: #3d1019;
  border-color: #3d1019;
}

.form-control:focus,
.form-select:focus {
  border-color: #3d1019;
  box-shadow: 0 0 0 0.2rem rgba(11, 54, 94, 0.25);
}

/* Badge Styles */
.badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
}

.bg-primary {
  background-color: rgba(var(--bs-primary-rgb), var(--bs-text-opacity)) !important;
}

.bg-secondary {
  background-color: #6b7280 !important;
}

/* Button Styles */
.btn-outline-secondary {
  border-color: #d1d5db;
  color: #6b7280;
}

.btn-outline-secondary:hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
  color: #1f2937;
}

.btn-outline-danger {
  border-color: #dc2626;
  color: #dc2626;
}

.btn-outline-danger:hover {
  background-color: #dc2626;
  border-color: #dc2626;
  color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
  .settings-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .settings-sidebar {
    position: static;
    order: 2;
  }
  
  .settings-content {
    order: 1;
  }
  
  .settings-content-inner {
    padding: 1rem;
  }
  
  .settings-section-header {
    max-width: 100%;
  }
  
  .settings-section-content {
    max-width: 100%;
  }
  
  .settings-title {
    font-size: 2rem;
  }
  
  .settings-row {
    grid-template-columns: 1fr; /* stack content and action */
    row-gap: 0.75rem;
    align-items: start;
  }
  
  .settings-row-content {
    width: 100%;
  }

  /* Place action under content on small screens */
  .settings-row > :last-child {
    justify-self: start;
  }
  
  .profile-avatar-section {
    flex-direction: column;
    text-align: center;
  }
  
  .session-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

@media (max-width: 1024px) {
  .settings-layout {
    grid-template-columns: 240px 1fr;
  }
  
  .settings-sidebar {
    padding: 1rem;
  }
  
  .settings-nav-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
  }
}

.communications-container .message-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(229, 231, 235, 0.5);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  will-change: transform;
  transform: translateZ(0);
  transition: transform 0.3s ease;
}

.communications-container .message-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.875rem;
  color: #1f2937;
  resize: none;
  min-height: 1.25rem;
  max-height: 8rem;
  line-height: 1.25rem;
}

.communications-container .message-input::placeholder {
  color: #6b7280;
}

.communications-container .input-btn {
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  background: none;
  color: #6b7280;
  cursor: pointer;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.communications-container .input-btn:hover {
  background: rgba(156, 163, 175, 0.1);
  color: #1f2937;
}

.communications-container .input-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.communications-container .send-btn {
  width: 2rem;
  height: 2rem;
  border: none;
  background: #9d5252;
  color: white;
  cursor: pointer;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.communications-container .send-btn:hover {
  background: #914040;
  transform: translateY(-1px);
  box-shadow: 0 6px 8px -1px rgba(0, 0, 0, 0.15);
}

/* Dark Mode Styles */
body.dark-mode {
  background: #141414;
}

/* Dark mode for main content wrapper */
body.dark-mode .client-main-content-wrapper {
  background-color: #141414 !important;
}

/* Dark mode for main content */
body.dark-mode .main-content.client-main-content {
  background-color: #181818 !important;
  color: #ffffff !important;
}

/* Dark mode for page header */
body.dark-mode .page-header {
  background-color: #181818 !important;
  border-bottom: 1px solid #333;
}

/* Dark mode for search input */
body.dark-mode .search-container input {
  background-color: #232323 !important;
  color: #ffffff !important;
  border-color: #333 !important;
}

body.dark-mode .search-container input::placeholder {
  color: #888 !important;
}

body.dark-mode .search-container i {
  color: #888 !important;
}

/* Dark mode for cards */
body.dark-mode .card,
body.dark-mode .matter-card,
body.dark-mode .stats-card,
body.dark-mode .document-card,
body.dark-mode .team-member-card,
body.dark-mode .matter-folder-card,
body.dark-mode .gd-card,
body.dark-mode .qa-card {
  background-color: #232323 !important;
  color: #ffffff !important;
  border-color: #333 !important;
}

/* Dark mode card hover states */
body.dark-mode .card:hover,
body.dark-mode .matter-card:hover,
body.dark-mode .stats-card:hover,
body.dark-mode .document-card:hover,
body.dark-mode .team-member-card:hover,
body.dark-mode .matter-folder-card:hover {
  background-color: #2a2a2a !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5) !important;
}

/* Dark mode scrollbar for matters container */
body.dark-mode .matters-scroll-container {
  scrollbar-color: rgba(200, 200, 200, 0.5) transparent;
}

body.dark-mode .matters-scroll-container::-webkit-scrollbar-thumb {
  background-color: rgba(200, 200, 200, 0.5);
}

body.dark-mode .matters-scroll-container::-webkit-scrollbar-thumb:hover {
  background-color: rgba(220, 220, 220, 0.7);
}

/* Dark mode text colors */
body.dark-mode .card-title,
body.dark-mode .card-text,
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3,
body.dark-mode h4, body.dark-mode h5, body.dark-mode h6,
body.dark-mode p, body.dark-mode span, body.dark-mode a,
body.dark-mode .text-muted,
body.dark-mode .lead,
body.dark-mode .display-1, body.dark-mode .display-2,
body.dark-mode .display-3, body.dark-mode .display-4 {
  color: #ffffff !important;
}

/* Dark mode for specific text elements */
body.dark-mode .text-muted,
body.dark-mode .small,
body.dark-mode small {
  color: #aaaaaa !important;
}

/* Dark mode for badges */
body.dark-mode .badge {
  background-color: #333 !important;
  color: #ffffff !important;
}

/* Dark mode for buttons */
body.dark-mode .btn-outline-secondary {
  color: #ffffff !important;
  border-color: #555 !important;
}

body.dark-mode .btn-outline-secondary:hover {
  background-color: #333 !important;
  border-color: #666 !important;
}

/* Dark mode for forms */
body.dark-mode .form-control,
body.dark-mode .form-select {
  background-color: #232323 !important;
  color: #ffffff !important;
  border-color: #333 !important;
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
  background-color: #232323 !important;
  color: #ffffff !important;
  border-color: #3d1019 !important;
}

/* Dark mode for modals */
body.dark-mode .modal-content {
  background-color: #181818 !important;
  color: #ffffff !important;
}

body.dark-mode .modal-header,
body.dark-mode .modal-footer {
  border-color: #333 !important;
}

/* Dark mode for sidebar */
body.dark-mode .client-sidebar,
body.dark-mode .global-dashboard-sidebar {
  background-color: #181818 !important;
  border-right-color: #333 !important;
}

body.dark-mode .client-sidebar .nav-link,
body.dark-mode .global-dashboard-sidebar .nav-link {
  color: #ffffff !important;
}

body.dark-mode .client-sidebar .nav-link:hover,
body.dark-mode .global-dashboard-sidebar .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode .client-sidebar .nav-link.active,
body.dark-mode .global-dashboard-sidebar .nav-link.active {
  background-color: #3d1019 !important;
  color: #ffffff !important;
}

/* Dark mode for chat panel */
body.dark-mode .chat-panel {
  background-color: transparent !important;
  border-left-color: #333 !important;
}

body.dark-mode .chat-header {
  background-color: #181818 !important;
  border-bottom-color: #333 !important;
}

body.dark-mode .chat-messages {
  background-color: #181818 !important;
}

body.dark-mode .chat-input {
  background-color: #181818 !important;
  border-top-color: #333 !important;
}

body.dark-mode .message-text {
  background-color: transparent !important;
  color: #ffffff !important;
}

body.dark-mode .ai-message-bubble .message-text {
  background-color: transparent !important;
  color: #ffffff !important;
}

body.dark-mode .user-message-bubble .message-text {
  background-color: #232323 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Dark mode for conversation tabs */
body.dark-mode .conversation-tab {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #ffffff !important;
}

body.dark-mode .conversation-tab:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode .conversation-tab.active {
  background-color: #3d1019 !important;
  color: #ffffff !important;
}

/* Dark mode for tables */
body.dark-mode table {
  color: #ffffff !important;
}

body.dark-mode .table {
  color: #ffffff !important;
  border-color: #333 !important;
}

body.dark-mode .table th,
body.dark-mode .table td {
  border-color: #333 !important;
}

/* Dark mode for list groups */
body.dark-mode .list-group-item {
  background-color: #232323 !important;
  color: #ffffff !important;
  border-color: #333 !important;
}

/* Dark mode for progress bars */
body.dark-mode .progress {
  background-color: #232323 !important;
}

/* Dark mode for alerts */
body.dark-mode .alert {
  background-color: #232323 !important;
  color: #ffffff !important;
  border-color: #333 !important;
}

/* Dark mode for dropdowns */
body.dark-mode .dropdown-menu {
  background-color: #232323 !important;
  border-color: #333 !important;
}

body.dark-mode .dropdown-item {
  color: #ffffff !important;
}

body.dark-mode .dropdown-item:hover {
  background-color: #333 !important;
  color: #ffffff !important;
}

/* Dark mode for nav tabs */
body.dark-mode .nav-tabs {
  border-color: #333 !important;
}

body.dark-mode .nav-tabs .nav-link {
  color: #ffffff !important;
}

body.dark-mode .nav-tabs .nav-link.active {
  background-color: #232323 !important;
  border-color: #333 !important;
  color: #ffffff !important;
}

/* Dark mode for offcanvas */
body.dark-mode .offcanvas {
  background-color: #181818 !important;
}

body.dark-mode .offcanvas-header,
body.dark-mode .offcanvas-body {
  border-color: #333 !important;
}

/* Dark mode for breadcrumbs */
body.dark-mode .breadcrumb {
  background-color: #232323 !important;
}

body.dark-mode .breadcrumb-item {
  color: #ffffff !important;
}

body.dark-mode .breadcrumb-item.active {
  color: #aaaaaa !important;
}

/* Dark mode toggle button */
.dark-mode-toggle {
  background-color: #FFFFFF; /* slightly lighter than hover */
  border: none;
  color: #3d1019;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.dark-mode-toggle:hover {
  background-color: #dcdcdc; /* slightly darker than default */
}

body.dark-mode .dark-mode-toggle {
  color: #ffffff;
  background-color: #232323; /* default in dark mode */
}

body.dark-mode .dark-mode-toggle:hover {
  background-color: #232323;
}

.dark-mode-toggle i {
  transition: transform 0.3s ease;
}

.dark-mode-toggle:hover i {
  transform: rotate(20deg);
}

/* Dark mode for clients popup */
body.dark-mode .clients-popup {
  background-color: #181818 !important;
}

body.dark-mode .clients-popup-header {
  background-color: #232323 !important;
  color: #ffffff !important;
}

body.dark-mode .clients-popup-title {
  color: #ffffff !important;
}

body.dark-mode .clients-popup-close {
  color: #ffffff !important;
}

body.dark-mode .client-item {
  border-bottom-color: #333 !important;
}

body.dark-mode .client-item:hover {
  background-color: #232323 !important;
}

body.dark-mode .client-name {
  color: #ffffff !important;
}

body.dark-mode .client-company,
body.dark-mode .client-status {
  color: #aaaaaa !important;
}

body.dark-mode .join-code-section {
  background-color: #232323 !important;
  border-top-color: #333 !important;
}

body.dark-mode .join-code-title {
  color: #ffffff !important;
}

body.dark-mode .join-code-input {
  background-color: #181818 !important;
  color: #ffffff !important;
  border-color: #333 !important;
}

body.dark-mode .join-code-message.success {
  background-color: #1a4d2e !important;
  color: #a7f3d0 !important;
  border-color: #065f46 !important;
}

body.dark-mode .join-code-message.error {
  background-color: #4d1a1a !important;
  color: #fca5a5 !important;
  border-color: #991b1b !important;
}

/* Dark mode for calendar in sidebar */
body.dark-mode .calendar-day-header {
  color: #888 !important;
}

body.dark-mode .calendar-day.current-month {
  color: #ffffff !important;
}

body.dark-mode .calendar-day.other-month {
  color: #444 !important;
}

body.dark-mode .calendar-day:hover:not(.today):not(.selected) {
  background-color: #333 !important;
}

/* Dark mode for recent files in sidebar */
body.dark-mode .recent-file-item h6 {
  color: #ffffff !important;
}

/* Dark mode for settings page */
body.dark-mode .settings-sidebar {
  background-color: #181818 !important;
  border-color: #333 !important;
}

body.dark-mode .settings-content {
  background-color: #181818 !important;
  border-color: #333 !important;
}

body.dark-mode .settings-section-content {
  background-color: #232323 !important;
  border-color: #333 !important;
}

body.dark-mode .settings-row {
  border-bottom-color: #333 !important;
}

body.dark-mode .settings-row-label {
  color: #ffffff !important;
}

body.dark-mode .settings-row-description {
  color: #aaaaaa !important;
}

/* Dark mode for session items */
body.dark-mode .session-item {
  background-color: #232323 !important;
  border-color: #333 !important;
}

body.dark-mode .session-icon {
  background-color: #181818 !important;
  color: #888 !important;
}

body.dark-mode .session-device {
  color: #ffffff !important;
}

body.dark-mode .session-location {
  color: #aaaaaa !important;
}

/* Dark mode for pagination */
body.dark-mode .pagination .page-link {
  background-color: #232323 !important;
  color: #ffffff !important;
  border-color: #333 !important;
}

body.dark-mode .pagination .page-link:hover {
  background-color: #333 !important;
  border-color: #555 !important;
}

body.dark-mode .pagination .page-item.active .page-link {
  background-color: #3d1019 !important;
  border-color: #3d1019 !important;
}

/* Dark mode for input groups */
body.dark-mode .input-group-text {
  background-color: #232323 !important;
  color: #ffffff !important;
  border-color: #333 !important;
}

/* Dark mode for deadline items */
body.dark-mode .deadline-item h6 {
  color: #ffffff !important;
}

/* Dark mode for matter preview and review sections */
body.dark-mode .matter-preview .card,
body.dark-mode .matter-review .form-control-plaintext {
  background-color: #232323 !important;
  color: #ffffff !important;
  border-color: #333 !important;
}

/* Dark mode for AI insights panel */
body.dark-mode .ai-insights-panel {
  background-color: #232323 !important;
  border-color: #333 !important;
}

body.dark-mode .ai-insights-header {
  background-color: #181818 !important;
  border-bottom-color: #333 !important;
}

body.dark-mode .ai-insight-card {
  background-color: #181818 !important;
  border-color: #333 !important;
}

/* Dark mode for services/discord-like interface */
body.dark-mode .communications-sidebar {
  background-color: #181818 !important;
  border-right-color: #333 !important;
}

body.dark-mode .communications-header {
  border-bottom-color: #333 !important;
}

body.dark-mode .communications-title {
  color: #ffffff !important;
}

body.dark-mode .communications-subtitle {
  color: #888 !important;
}

body.dark-mode .channel-item {
  color: #aaaaaa !important;
}

body.dark-mode .channel-item:hover,
body.dark-mode .channel-item.active {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

body.dark-mode .user-panel {
  background-color: #2a2a2a !important;
  border-top-color: #333 !important;
  border-radius: 12px;
}

body.dark-mode .user-info {
  background-color: #232323 !important;
}

body.dark-mode .user-name {
  color: #ffffff !important;
}

body.dark-mode .user-status {
  color: #888 !important;
}

body.dark-mode .main-chat {
  background-color: #181818 !important;
}

body.dark-mode .message-author {
  color: #ffffff !important;
}

body.dark-mode .message-time {
  color: #888 !important;
}

body.dark-mode .communications-container .message-text {
  color: #ffffff !important;
}

/* Multi-Step Matter Creation Form Styles */
.min-h-screen {
  min-height: 100vh;
}

.bg-gradient-subtle {
  background: linear-gradient(135deg, #ffffff 0%, #eee9e9 100%);
}

/* Progress Indicator */
.progress-step {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  border: 2px solid #e5e7eb;
  color: #6b7280;
  background: white;
  transition: all 0.3s ease;
}

.progress-step.active {
  background: #3d1019;
  border-color: #3d1019;
  color: white;
}

.progress-step-label {
  margin-left: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.3s ease;
}

.progress-step-label.active {
  color: #1f2937;
  font-weight: 600;
}

.progress-line {
  flex: 1;
  height: 1px;
  background: #e5e7eb;
  margin: 0 1rem;
}

/* Form Styling */
.shadow-elegant {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.form-control-lg {
  height: 3rem;
  font-size: 1rem;
  padding: 0.75rem 1rem;
}

.form-select-lg {
  height: 3rem;
  font-size: 1rem;
  padding: 0.75rem 1rem;
}

/* Matter Preview */
.matter-preview .card {
  background: linear-gradient(135deg, #ffffff 0%, #eee9e9 100%);
  border: 1px solid #e5e7eb;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Matter Review */
.matter-review .form-control-plaintext {
  background: #f8fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0;
  color: #374151;
}

/* Button Styling */
.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #e5e7eb;
  color: #6b7280;
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

/* Utility Classes */
.flex-1 {
  flex: 1;
}

.max-w-2xl {
  max-width: 42rem;
}

.w-25 {
  width: 25%;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-5 {
  gap: 3rem;
}

.gap-6 {
  gap: 1.5rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mb-8 {
  margin-bottom: 2rem;
}

.py-8 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.py-4 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Responsive adjustments for matter creation form */
@media (max-width: 768px) {
  .d-flex.gap-5 {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .w-25 {
    width: 100%;
  }
  
  .progress-line {
    margin: 0 0.5rem;
  }
  
  .progress-step-label {
    font-size: 0.75rem;
    margin-left: 0.5rem;
  }
  
  .display-4 {
    font-size: 2rem;
  }
  
  .lead {
    font-size: 1rem;
  }
}

@media (max-width: 1024px) {
  .gap-5 {
    gap: 2rem;
  }
  
  .w-25 {
    width: 30%;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .communications-container {
    height: 100%;
  }
  
  .communications-sidebar {
    width: 14rem;
  }
  
  .communications-title {
    font-size: 1rem;
  }
  
  .channel-item {
    padding: 0.375rem 1rem;
  }
  
  .message-avatar {
    width: 2rem;
    height: 2rem;
    font-size: 0.875rem;
  }
  
  .message-text {
    font-size: 0.8125rem;
  }
}

/* ... existing code ... */
body.dark-mode .communications-container .message-text {
  color: #ffffff !important;
}

/* Dashboard-specific dark mode tweaks */
body.dark-mode .global-dashboard-main .left-column {
  background-color: #161616 !important;
}

/* Ensure daily briefing card matches other dark cards */
body.dark-mode .daily-briefing-card .card-body,
body.dark-mode .global-dashboard-main .qa-card,
body.dark-mode .global-dashboard-main .gd-card {
  background-color: #232323 !important;
}

/* Large search in AI chat (dashboard hero) */
body.dark-mode .search-container-large {
  background-color: #232323 !important;
  border-color: #333 !important;
}

body.dark-mode .search-container-large input.form-control.form-control-lg {
  background-color: transparent !important;
  color: #ffffff !important;
}

body.dark-mode .search-container-large input::placeholder {
  color: #888 !important;
}

body.dark-mode .search-container-large i,
body.dark-mode .search-actions .btn {
  color: #aaa !important;
}

body.dark-mode .search-container-large > i.fa-plus:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #9d5252 !important;
}

body.dark-mode .search-container-large .search-actions .btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .search-container-large .search-actions .btn:hover i {
  color: #9d5252 !important;
}

/* Any remaining explicit text-dark helpers should be white in dark mode */
body.dark-mode .text-dark {
  color: #ffffff !important;
}

/* Dark mode: Quick Access Matters icon color */
body.dark-mode .global-dashboard-main .quick-access-icon .fa-briefcase {
  color: #3d1019 !important;
}

/* ========================================
   Matter Details Page Styles
   ======================================== */

/* Matter Details Container */
.matter-details-container {
  background: #ffffff;
  min-height: 100vh;
}

/* Header Section */
.matter-details-header {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.matter-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3d1019, #3d1019);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.matter-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.matter-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

/* Tab Navigation */
.matter-tabs {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.matter-tabs .d-flex {
  display: flex !important;
  width: 100%;
}

.matter-tab-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex: 1;
  text-align: center;
}

.matter-tab-link:hover {
  color: #1f2937;
  border-bottom-color: #e5e7eb;
  background-color: #f9fafb;
}

.matter-tab-link.active {
  color: #3d1019;
  border-bottom-color: #3d1019;
  background-color: transparent;
}

.matter-tab-link i {
  font-size: 1rem;
}

/* Tab Content */
.matter-content-container {
  background: #f9fafb;
  min-height: calc(100vh - 200px);
}

.tab-content-section {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stat Cards - Reuse and enhance existing styles */
.stats-card {
  transition: all 0.3s ease;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.stats-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

/* Summary Cards */
.card {
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Progress Bar Enhancements */
.progress {
  border-radius: 4px;
  background-color: #e5e7eb;
  height: 8px;
}

.progress-bar {
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* Donut Chart Styling */
.tab-content-section svg circle {
  transition: stroke-dasharray 0.6s ease;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .matter-title {
    font-size: 1rem;
  }
  
  .matter-subtitle {
    font-size: 0.75rem;
  }
  
  .matter-icon-badge {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
  }
  
  .matter-tab-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
  
  .matter-tab-link span {
    display: none;
  }
  
  .matter-tab-link i {
    font-size: 1.125rem;
  }
}

/* Ensure proper spacing */
.matter-content-container .container-fluid {
  max-width: 100%;
}

/* Matter Index - Clickable Cards */
.matter-card-wrapper a {
  display: block;
  text-decoration: none;
  color: inherit;
}

.matter-card-wrapper a:hover .matter-card {
  background-color: #eef1f3;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2) !important;
}

/* Matter Details Summary Grid - Match Matter/Index spacing */
#matters-grid {
  --bs-gutter-x: 1rem;
}

#matters-grid .matter-card {
  transition: all 0.3s ease;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

#matters-grid .matter-card:hover {
  background-color: #eef1f3;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2) !important;
}

/* Matter Info Carousel */
.matter-info-carousel {
  position: relative;
  overflow: hidden;
  width: 100%;
  cursor: grab;
}

.matter-info-carousel:active {
  cursor: grabbing;
}

.carousel-slider {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  width: 100%;
  /* Removed will-change to prevent blurry text */
}

.carousel-slide {
  min-width: 100%;
  flex-shrink: 0;
  padding-right: 0.25rem;
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
  /* Removed transforms to prevent blurry text - match Status Overview card styling */
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
  padding: 0.5rem 0;
}

.carousel-arrow {
  background: transparent;
  border: none;
  color: #3d1019;
  font-size: 0.95rem; /* smaller arrows */
  cursor: pointer;
  padding: 0.25rem 0.35rem;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.carousel-arrow:hover:not(:disabled) {
  background-color: rgba(61, 16, 25, 0.1);
  transform: scale(1.1);
}

.carousel-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.carousel-dots {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #d1d5db;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-dot.active {
  background-color: #3d1019;
  width: 18px;
  border-radius: 4px;
}

.carousel-dot:hover {
  background-color: #9ca3af;
}

/* Carousel snapshot content styling */
.carousel-slide .snapshot-content {
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: normal;
  overflow: hidden;
}

/* Prevent Bootstrap row negative margins from causing horizontal overflow inside slides */
.matter-info-carousel .row {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.matter-info-carousel [class^="col-"],
.matter-info-carousel [class*=" col-"] {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  box-sizing: border-box;
}

/* Ensure form controls don't expand slide width */
.matter-info-carousel .form-control,
.matter-info-carousel .form-select {
  max-width: 100%;
}

.carousel-slide .snapshot-content strong {
  color: #1f2937;
  font-weight: 600;
}

.carousel-slide .snapshot-content .text-muted {
  color: #6b7280;
}

/* Prevent hover effect on carousel card */
#matters-grid .matter-card-wrapper.carousel-wrapper .matter-card:hover {
  transform: none;
  background-color: transparent;
}

/* Sticky Last Message Overlay for AI Chat */
.sticky-last-message {
  position: absolute;
  top: 0;
  left: 0.25rem;
  right: 0;
  z-index: 150;
  background: linear-gradient(to bottom, #f1ece8 0%, transparent 99%, transparent 100%);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  padding: 0.25rem 1rem 0.25rem 0.5rem; /* Reduced bottom padding - extra right for scrollbar */
}

.sticky-last-message.visible {
  opacity: 1;
  transform: translateY(0);
}

.sticky-message-content {
  max-height: none; /* Allow dynamic height to match actual message */
  overflow: visible;
  pointer-events: auto;
  width: auto;
  margin-left: 0.25rem;
}

/* Style the sticky message to exactly match regular user messages */
.sticky-last-message .user-message-bubble {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0;
  width: 100%;
  margin-left: auto;
}

.sticky-last-message .user-message-bubble .message-content {
  width: 100%;
}

.sticky-last-message .message-text {
  background: white !important;
  color: #374151 !important;
  padding: 0.75rem !important;
  border-radius: 16px !important;
  line-height: 1.5;
  font-size: 0.85rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25) !important;
  border: none !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  /* Limit to 5 lines with ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: calc(1.5 * 0.85rem * 5 + 1.5rem); /* 5 lines + padding */
}

.sticky-last-message .message-header {
  display: none; /* Hide timestamp in sticky overlay */
}

.sticky-last-message .message-content {
  width: 100%;
}

/* Add padding to chat messages to account for sticky overlay when visible */
/* Removed dynamic padding to prevent scroll jiggling - sticky overlay now uses absolute positioning */

/* Communications Search Bar - Match Page Header Styling */
.comms-search-container {
  position: relative;
  padding: 0.75rem 1.5rem;
}

.comms-search-icon {
  position: absolute;
  left: 2.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  pointer-events: none;
  z-index: 1;
}

.comms-search-input {
  width: 100%;
  height: 2.5rem;
  line-height: 1.25;
  border-radius: 24px;
  padding: 0.75rem 1.5rem 0.75rem 2.75rem;
  background-color: #f9fafb;
  font-size: 1rem;
  border: transparent;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.comms-search-input:focus {
  background-color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.comms-search-input::placeholder {
  color: #9ca3af;
}