.nav-link {
    @apply block px-6 py-3 text-gray-600 hover:bg-gray-100 hover:text-gray-800 rounded-md mx-2 my-1 transition-colors duration-200;
}

.nav-link.active {
    @apply bg-blue-50 text-blue-600 border border-blue-100 shadow-sm;
}

.card {
  background-color: #ffffff;
  border: 1px solid #d1d5db; /* gray-300 */
  border-radius: 0.75rem; /* rounded-xl */
  padding: 1.5rem; /* p-6 */
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05); /* shadow-sm */
  transition: box-shadow 0.2s ease;
  box-sizing: border-box;
  max-width: 100%;
  width: 100%;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

@media (max-width: 640px) {
  .card {
    padding: 1rem;
    border-radius: 0.75rem;
  }
}

.stat-card {
    @apply bg-white rounded-xl shadow-sm border border-gray-100 p-6;
}

.stat-number {
    @apply text-3xl font-extrabold text-gray-900;
}

.stat-label {
    @apply text-sm text-gray-600 mt-1;
}

.btn-primary {
    @apply inline-flex items-center justify-center bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white px-4 py-2 rounded-lg shadow-sm hover:shadow transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-blue-400;
}

.btn-secondary {
    @apply inline-flex items-center justify-center bg-gray-100 hover:bg-gray-200 text-gray-800 px-4 py-2 rounded-lg border border-gray-200 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-gray-300;
}

.btn-danger {
    @apply inline-flex items-center justify-center bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg shadow-sm transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-red-400;
}

.status-badge {
    @apply px-2 py-1 rounded-full text-xs font-medium;
}

.status-active {
    @apply bg-green-100 text-green-800;
}

.status-inactive {
    @apply bg-red-100 text-red-800;
}

.status-pending {
    @apply bg-yellow-100 text-yellow-800;
}

.priority-high {
    @apply bg-red-100 text-red-800;
}

.priority-medium {
    @apply bg-yellow-100 text-yellow-800;
}

.priority-low {
    @apply bg-green-100 text-green-800;
}

.table-row {
    @apply hover:bg-gray-50 transition-colors duration-200;
}

.modal-overlay {
  padding: 1rem;
  overscroll-behavior: contain;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-panel {
  max-height: 90vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

@media (max-height: 640px) {
  .modal-overlay {
    align-items: flex-start;
  }
  .modal-panel {
    max-height: calc(100vh - 2rem);
  }
}

html.modal-open,
body.modal-open {
  overflow: hidden;
  overscroll-behavior: contain;
}

/* Dashboard tiles */
.tile {
    @apply relative overflow-hidden rounded-2xl p-5 text-white shadow-sm hover:shadow-md transition-shadow duration-200;
}
.tile .tile-icon {
    @apply w-10 h-10 rounded-full bg-white/20 flex items-center justify-center text-lg mb-3;
}
.tile .tile-value {
    @apply text-3xl font-extrabold leading-tight;
}
.tile .tile-label {
    @apply text-sm text-white/80 mt-1;
}
.tile-blue {
    @apply bg-gradient-to-br from-blue-500 to-indigo-600;
}
.tile-green {
    @apply bg-gradient-to-br from-emerald-500 to-green-600;
}
.tile-purple {
    @apply bg-gradient-to-br from-violet-500 to-purple-600;
}
.tile-amber {
    @apply bg-gradient-to-br from-amber-500 to-orange-500;
}

/* Section cards with colored backgrounds overriding default card */

.chat-link {
  color: #2563eb;
  text-decoration: underline;
  word-break: break-all;
}
.chat-link:hover {
  color: #1d4ed8;
}

.chat-session-item {
  width: 100%;
  text-align: left;
  background-color: #fff2d7;
  border: 1px solid #fdba74;
  border-radius: 0.5rem;
  padding: 0.65rem 0.85rem;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: #7c2d12;
}
.chat-session-item:hover {
  background-color: #ffe9cc;
  border-color: #fb923c;
  transform: translateY(-1px);
}
.chat-session-item.active {
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
  background-color: #ffe2bf;
}
.chat-session-item.chat-session-new {
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #374151;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.chat-session-item.chat-session-new:hover {
  background-color: #e5e7eb;
  border-color: #9ca3af;
}
.chat-session-item.chat-session-new.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
  background-color: #e0e7ff;
  color: #1f2937;
}
.chat-new-session-active {
  background: linear-gradient(135deg, #bbf7d0 0%, #22c55e 100%);
  color: #064e3b;
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 10px 25px rgba(34, 197, 94, 0.25);
}
.chat-new-session-active:hover,
.chat-new-session-active:focus {
  background: linear-gradient(135deg, #6ee7b7 0%, #16a34a 100%);
  color: #064e3b;
  border-color: rgba(34, 197, 94, 0.6);
}
.chat-session-item .session-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: #7c2d12;
  margin-bottom: 0.125rem;
  text-align: left;
  flex: 1;
}
.chat-session-item .session-meta {
  font-size: 0.56rem;
  color: #9a3412;
  flex-shrink: 0;
  text-align: right;
}

.timeline {
  position: relative;
  padding-left: 0.5rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 1.35rem;
  top: 0.25rem;
  bottom: 0.25rem;
  width: 2px;
  background: #e5e7eb;
}
.timeline-item {
  position: relative;
  padding-left: 3.25rem;
}
.timeline-marker {
  position: absolute;
  left: 0.75rem;
  top: 0.4rem;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: #f3f4f6;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(229, 231, 235, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #4b5563;
}
.timeline-marker--success {
  background: #dcfce7;
  color: #15803d;
  box-shadow: 0 0 0 2px rgba(187, 247, 208, 0.7);
}
.timeline-marker--danger {
  background: #fee2e2;
  color: #b91c1c;
  box-shadow: 0 0 0 2px rgba(254, 202, 202, 0.7);
}
.timeline-marker--pending {
  background: #dbeafe;
  color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(191, 219, 254, 0.7);
}
.timeline-content {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
}
.chat-session-item .session-meta span {
  display: block;
}
.chat-session-empty {
  font-size: 0.75rem;
  color: #6b7280;
  padding: 0.25rem 0;
  grid-column: 1 / -1;
}
.agent-chat-sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
#agentChatSessions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
#agentChatSessions > * {
  margin: 0 !important;
}
.section-card {
  background-color: #ffffff;
  border: 1px solid #d1d5db; /* gray-300 */
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  padding: 1.5rem;
}
.section-blue { border-color: #bfdbfe; /* blue-200 */ }
.section-green { border-color: #bbf7d0; /* green-200 */ }
.section-amber { border-color: #fde68a; /* amber-200 */ }
.section-purple { border-color: #ddd6fe; /* purple-200 */ }
.section-gray { border-color: #d1d5db; /* gray-300 */ }

/* Headings inside cards: stronger contrast */
.card h3, .section-card h3 { @apply text-gray-900 font-semibold; }
.card h3 + *, .section-card h3 + * { }

/* Tables inside cards: clearer separation */
.card table thead th, .section-card table thead th {
  background-color: #f9fafb; /* gray-50 */
  color: #1f2937; /* gray-800 */
  font-weight: 500;
}
.card table tbody tr { background-color: #ffffff; }
.card table tbody tr:nth-child(odd) { background-color: #fafafa; }
.card table tbody tr + tr {
  border-top: 1px solid #e5e7eb; /* gray-200 */
}
.min-h-120 {
    min-height: 120px;
}
#aiSalesOut, #aiMontOut {
    border-left: 4px solid #819bdb;
    font-weight: 500;
    font-style: italic;
}
.@media (max-width: 640px) {
}

/* Mobile tables: tighter spacing */
@media (max-width: 640px) {
  table.min-w-full th,
  table.min-w-full td {
    padding: 0.25rem 0.5rem; /* 1px top/bottom, 8px left/right approx */
    font-size: 0.875rem; /* text-sm */
  }
}

/* FullCalendar responsive tuning */
.fc .fc-toolbar {
  gap: .25rem;
  align-items: center;
}
.fc .fc-button {
  background: #1f2937; /* gray-800 */
  border: 1px solid #e5e7eb; /* gray-200 */
  color: #fff;
  padding: .25rem .5rem;
  font-size: .875rem; /* text-sm */
  border-radius: .5rem; /* rounded-lg */
}
.fc .fc-button:hover { background: #111827; }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: #2563eb; /* blue-600 */
  border-color: #2563eb;
}
.fc .fc-toolbar-title { font-weight: 700; }
@media (max-width: 640px) {
  .fc .fc-toolbar-title { font-size: 1.125rem; } /* text-lg */
}

/* Minimal activity dot on month cells when we add class via JS */
.fc-day-has-activity .fc-daygrid-day-number::after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  background: #2563eb; /* blue-600 */
  border-radius: 9999px;
  margin: 2px auto 0 auto;
}

.qa-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.05rem 0.1rem;
}
.qa-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.qa-preview {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.75rem 0;
}
.qa-preview:last-child {
  border-bottom: none;
}
.qa-preview .text-gray-700 {
  margin-top: 0.25rem;
}

.dashboard-chart-wrap {
  position: relative;
  height: 150px;
  max-height: 150px;
  padding: 0.5rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(229, 231, 235, 0.75) 100%);
  border: 1px solid rgba(148, 163, 184, 0.2);
  overflow: hidden;
}
.dashboard-chart {
  position: absolute;
  inset: 0.5rem 0.5rem 1rem 0.5rem;
  height: 100% !important;
  max-height: 100%;
  width: 100% !important;
}

.dashboard-widget {
  position: relative;
  border-radius: 1.5rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  color: #ffffff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}
.dashboard-widget__icon {
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
}
.dashboard-widget__icon svg {
  width: 1.5rem;
  height: 1.5rem;
}
.dashboard-widget__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}
.dashboard-widget__value {
  font-size: 2.5rem;
  line-height: 1.1;
  font-weight: 700;
}
.dashboard-widget__sublabel {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.75);
}
.dashboard-widget--blue {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}
.dashboard-widget--teal {
  background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
}
.dashboard-widget--green {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}
.dashboard-widget--green-light {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
}
.dashboard-widget--green-deep {
  background: linear-gradient(135deg, #047857 0%, #064e3b 100%);
}
.dashboard-widget--orange {
  background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
}
.dashboard-widget--purple {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
}

.dashboard-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.09);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.dashboard-card--chart {
  gap: 1rem;
}
.dashboard-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.dashboard-card__title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: #475569;
}
.dashboard-card__subtitle {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}
.dashboard-card__icon {
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  color: #1d4ed8;
}
.dashboard-card__icon svg {
  width: 1.5rem;
  height: 1.5rem;
}
.dashboard-card__icon--purple {
  background: #ede9fe;
  color: #5b21b6;
}
.dashboard-card__icon--green {
  background: #dcfce7;
  color: #047857;
}
.dashboard-card__icon--blue {
  background: #e0f2fe;
  color: #0369a1;
}
.dashboard-card__list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}
.dashboard-card__list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 0.85rem 1rem;
}
.dashboard-card__list-item--empty {
  justify-content: center;
  background: #f1f5f9;
  color: #475569;
}
.dashboard-card__list-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
}
.dashboard-card__list-meta {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
}
.dashboard-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  white-space: nowrap;
}
