/* ===== OVERVIEW AGENT DASHBOARD ===== */

.oa-dashboard-container {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Page Header */

.oa-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
}

.oa-page-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.oa-page-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.oa-period-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin: 0;
  white-space: nowrap;
}

html[data-bs-theme="dark"] .oa-period-label {
  color: #c8c8c8;
}

.oa-page-header-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #8e09f9, #6a07b8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  box-shadow: 0 8px 24px rgba(142, 9, 249, 0.35);
}

.oa-page-title {
  margin: 0;
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

.oa-page-subtitle {
  margin: 2px 0 0;
  font-size: 0.88rem;
  color: #888;
  font-weight: 500;
}

html[data-bs-theme="dark"] .oa-page-subtitle {
  color: #999;
}

/* Card */

.oa-card {
  background: linear-gradient(145deg, #ffffff, #f8f9fa);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(142, 9, 249, 0.08);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.oa-card:hover {
  box-shadow: 0 8px 36px rgba(142, 9, 249, 0.12);
}

html[data-bs-theme="dark"] .oa-card {
  background: linear-gradient(145deg, #1e2126, #181a1e);
  border-color: rgba(142, 9, 249, 0.15);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

html[data-bs-theme="dark"] .oa-card:hover {
  box-shadow: 0 8px 36px rgba(142, 9, 249, 0.2);
}

/* Card Header */

.oa-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.oa-card-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.oa-icon-blue {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.oa-icon-purple {
  background: linear-gradient(135deg, #8e09f9, #6a07b8);
  box-shadow: 0 4px 14px rgba(142, 9, 249, 0.35);
}

.oa-icon-green {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.oa-icon-orange {
  background: linear-gradient(135deg, #f97316, #ea580c);
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
}

.oa-icon-teal {
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.35);
}

.oa-icon-indigo {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.oa-icon-pink {
  background: linear-gradient(135deg, #ec4899, #db2777);
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.35);
}

.oa-icon-cyan {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.oa-icon-red {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.oa-card-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.1rem;
  color: #2d2d2d;
  flex: 1;
}

html[data-bs-theme="dark"] .oa-card-title {
  color: #e8e8e8;
}

.oa-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Stats Row */

.oa-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

/* Stat Pill */

.oa-stat-pill {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 20px;
  border-radius: 14px;
  min-width: 120px;
  flex: 1 1 140px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* I .row di Bootstrap dentro le card riempiono l'area interna senza margini
   negativi che sforano il padding della card. */

.oa-card .row {
  margin-left: 0;
  margin-right: 0;
  width: 100%;
}

.oa-stat-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

html[data-bs-theme="dark"] .oa-stat-pill:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.oa-stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
}

.oa-stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Pill colors - Light */

.oa-pill-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.18);
  color: #059669;
}

.oa-pill-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.18);
  color: #dc2626;
}

.oa-pill-primary {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
  border: 1px solid rgba(59, 130, 246, 0.18);
  color: #2563eb;
}

.oa-pill-info {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(6, 182, 212, 0.05));
  border: 1px solid rgba(6, 182, 212, 0.18);
  color: #0891b2;
}

.oa-pill-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.18);
  color: #d97706;
}

.oa-pill-purple {
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.1), rgba(142, 9, 249, 0.05));
  border: 1px solid rgba(142, 9, 249, 0.18);
  color: #7c3aed;
}

/* Pill colors - Dark */

html[data-bs-theme="dark"] .oa-pill-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(16, 185, 129, 0.08));
  border-color: rgba(16, 185, 129, 0.28);
  color: #34d399;
}

html[data-bs-theme="dark"] .oa-pill-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(239, 68, 68, 0.08));
  border-color: rgba(239, 68, 68, 0.28);
  color: #fca5a5;
}

html[data-bs-theme="dark"] .oa-pill-primary {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.08));
  border-color: rgba(59, 130, 246, 0.28);
  color: #93c5fd;
}

html[data-bs-theme="dark"] .oa-pill-info {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(6, 182, 212, 0.08));
  border-color: rgba(6, 182, 212, 0.28);
  color: #67e8f9;
}

html[data-bs-theme="dark"] .oa-pill-warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0.08));
  border-color: rgba(245, 158, 11, 0.28);
  color: #fcd34d;
}

html[data-bs-theme="dark"] .oa-pill-purple {
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.18), rgba(142, 9, 249, 0.08));
  border-color: rgba(142, 9, 249, 0.28);
  color: #c4b5fd;
}

/* Chart container */

.oa-chart-container {
  margin-top: 16px;
}

/* Select & Refresh Button */

.oa-select {
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid rgba(142, 9, 249, 0.2);
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  appearance: auto;
}

.oa-select:focus {
  outline: none;
  border-color: #8e09f9;
  box-shadow: 0 0 0 3px rgba(142, 9, 249, 0.15);
}

.oa-refresh-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(142, 9, 249, 0.2);
  background: var(--bs-body-bg);
  color: #8e09f9;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

.oa-refresh-btn:hover {
  background: rgba(142, 9, 249, 0.08);
  border-color: rgba(142, 9, 249, 0.4);
  transform: rotate(90deg);
}

.oa-refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Animations */

.oa-card {
  /*opacity: 0;*/
  transform: translateY(16px);
  animation: oaCardAppear 0.4s ease-out forwards;
}

.oa-card:nth-child(2) {
  animation-delay: 0.04s;
}

.oa-card:nth-child(3) {
  animation-delay: 0.08s;
}

.oa-card:nth-child(4) {
  animation-delay: 0.12s;
}

.oa-card:nth-child(5) {
  animation-delay: 0.16s;
}

.oa-card:nth-child(6) {
  animation-delay: 0.20s;
}

.oa-card:nth-child(7) {
  animation-delay: 0.24s;
}

.oa-card:nth-child(8) {
  animation-delay: 0.28s;
}

.oa-card:nth-child(9) {
  animation-delay: 0.32s;
}

.oa-card:nth-child(10) {
  animation-delay: 0.36s;
}

.oa-card:nth-child(11) {
  animation-delay: 0.40s;
}

@keyframes oaCardAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */

@media (max-width: 768px) {
  .oa-dashboard-container {
    padding: 10px;
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .oa-card {
    padding: 20px;
    border-radius: 16px;
  }
}

@media (max-width: 768px) {
  .oa-stats-row {
    gap: 8px;
  }
}

@media (max-width: 768px) {
  .oa-stat-pill {
    min-width: 0;
    flex: 1 1 calc(50% - 4px);
    padding: 10px 14px;
  }
}

@media (max-width: 768px) {
  .oa-page-header-icon {
    width: 44px;
    height: 44px;
    font-size: 20px;
    border-radius: 12px;
  }
}

@media (max-width: 768px) {
  .oa-page-title {
    font-size: 1.3rem;
  }
}

@media (max-width: 768px) {
  .oa-card-header {
    gap: 10px;
  }
}

@media (max-width: 768px) {
  .oa-card-actions {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .oa-select {
    flex: 1;
  }
}

/* ===== FAQ AUTO-GENERATE SECTION ===== */

.oa-icon-faq {
  background: linear-gradient(135deg, #8e09f9, #ec4899);
  box-shadow: 0 4px 14px rgba(142, 9, 249, 0.35);
}

/* Generate Button */

.oa-faq-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 22px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #8e09f9, #6a07b8);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(142, 9, 249, 0.3);
  letter-spacing: 0.02em;
}

.oa-faq-generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(142, 9, 249, 0.45);
  background: linear-gradient(135deg, #a033ff, #7c0fd6);
}

.oa-faq-generate-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(142, 9, 249, 0.3);
}

.oa-faq-generate-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 8px rgba(142, 9, 249, 0.2);
}

/* Empty State */

.oa-faq-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.oa-faq-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.1), rgba(236, 72, 153, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #8e09f9;
  margin-bottom: 16px;
}

html[data-bs-theme="dark"] .oa-faq-empty-icon {
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.2), rgba(236, 72, 153, 0.15));
  color: #c4b5fd;
}

.oa-faq-empty-state h5 {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 8px;
}

.oa-faq-empty-state p {
  font-size: 0.88rem;
  color: #888;
  max-width: 440px;
  margin: 0;
  line-height: 1.6;
}

html[data-bs-theme="dark"] .oa-faq-empty-state p {
  color: #999;
}

/* FAQ Results Header */

.oa-faq-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--bs-border-color);
}

.oa-faq-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.12), rgba(236, 72, 153, 0.08));
  color: #8e09f9;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid rgba(142, 9, 249, 0.18);
}

html[data-bs-theme="dark"] .oa-faq-count-badge {
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.2), rgba(236, 72, 153, 0.12));
  color: #c4b5fd;
  border-color: rgba(142, 9, 249, 0.3);
}

.oa-faq-actions-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.oa-faq-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid;
}

.oa-faq-action-btn-suggested {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
  color: #059669;
}

.oa-faq-action-btn-suggested:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

html[data-bs-theme="dark"] .oa-faq-action-btn-suggested {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.oa-faq-action-btn-kb {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.25);
  color: #0891b2;
}

.oa-faq-action-btn-kb:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateY(-1px);
}

html[data-bs-theme="dark"] .oa-faq-action-btn-kb {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.3);
  color: #67e8f9;
}

/* FAQ Item Card */

.oa-faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.oa-faq-item {
  border: 1px solid var(--bs-border-color);
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.25s ease;
  background: var(--bs-body-bg);
}

.oa-faq-item:hover {
  border-color: rgba(142, 9, 249, 0.25);
  box-shadow: 0 4px 16px rgba(142, 9, 249, 0.08);
}

html[data-bs-theme="dark"] .oa-faq-item:hover {
  border-color: rgba(142, 9, 249, 0.35);
  box-shadow: 0 4px 16px rgba(142, 9, 249, 0.15);
}

.oa-faq-item-header {
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: background 0.15s ease;
}

.oa-faq-item-header:hover {
  background: rgba(142, 9, 249, 0.03);
}

html[data-bs-theme="dark"] .oa-faq-item-header:hover {
  background: rgba(142, 9, 249, 0.06);
}

.oa-faq-freq-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.1), rgba(142, 9, 249, 0.05));
  color: #8e09f9;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  border: 1px solid rgba(142, 9, 249, 0.15);
}

html[data-bs-theme="dark"] .oa-faq-freq-badge {
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.2), rgba(142, 9, 249, 0.1));
  color: #c4b5fd;
  border-color: rgba(142, 9, 249, 0.25);
}

.oa-faq-item-body {
  flex: 1;
  min-width: 0;
}

.oa-faq-question-text {
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 4px;
  color: var(--bs-body-color);
  line-height: 1.4;
}

.oa-faq-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
}

.oa-faq-topic-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(142, 9, 249, 0.08);
  color: #8e09f9;
  font-weight: 600;
  font-size: 0.72rem;
}

html[data-bs-theme="dark"] .oa-faq-topic-tag {
  background: rgba(142, 9, 249, 0.15);
  color: #c4b5fd;
}

.oa-faq-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: flex-start;
}

.oa-faq-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--bs-border-color);
  background: transparent;
  color: var(--bs-secondary-color);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
}

.oa-faq-mini-btn:hover {
  transform: translateY(-1px);
}

.oa-faq-mini-btn-suggested:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #059669;
}

.oa-faq-mini-btn-kb:hover {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.3);
  color: #0891b2;
}

.oa-faq-chevron {
  font-size: 11px;
  color: var(--bs-secondary-color);
  transition: transform 0.25s ease;
  margin-top: 10px;
  flex-shrink: 0;
}

/* FAQ Detail Panel */

.oa-faq-detail {
  display: none;
  padding: 0 18px 16px 66px;
  border-top: 1px solid var(--bs-border-color);
  animation: oaFaqDetailAppear 0.25s ease-out;
}

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

.oa-faq-detail-label {
  margin: 12px 0 8px;
  font-size: 0.7rem;
  color: var(--bs-secondary-color);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
}

.oa-faq-answer-box {
  font-size: 0.88rem;
  color: var(--bs-body-color);
  white-space: pre-wrap;
  line-height: 1.65;
  padding: 12px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.03), rgba(236, 72, 153, 0.02));
  border: 1px solid rgba(142, 9, 249, 0.08);
}

html[data-bs-theme="dark"] .oa-faq-answer-box {
  background: linear-gradient(135deg, rgba(142, 9, 249, 0.06), rgba(236, 72, 153, 0.03));
  border-color: rgba(142, 9, 249, 0.12);
}

/* FAQ Loading State */

.oa-faq-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.oa-faq-loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(142, 9, 249, 0.15);
  border-top-color: #8e09f9;
  border-radius: 50%;
  animation: oaFaqSpin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

.oa-faq-loading p {
  font-size: 0.88rem;
  color: #888;
  margin: 0;
  font-weight: 500;
}

/* FAQ Error State */

.oa-faq-error {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #dc2626;
  font-size: 0.88rem;
  font-weight: 600;
}

html[data-bs-theme="dark"] .oa-faq-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* FAQ No-data State */

.oa-faq-nodata {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 10px;
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.15);
  color: #0891b2;
  font-size: 0.88rem;
  font-weight: 500;
}

html[data-bs-theme="dark"] .oa-faq-nodata {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.2);
  color: #67e8f9;
}

/* Responsive FAQ */

@media (max-width: 768px) {
  .oa-faq-results-header {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 768px) {
  .oa-faq-actions-group {
    justify-content: stretch;
  }
}

@media (max-width: 768px) {
  .oa-faq-action-btn {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .oa-faq-item-header {
    padding: 12px 14px;
  }
}

@media (max-width: 768px) {
  .oa-faq-detail {
    padding-left: 14px;
  }
}

@media (max-width: 768px) {
  .oa-faq-generate-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ===== AI SUMMARY CARD ===== */

.oa-summary-card {
  border: 1px solid rgba(99, 102, 241, 0.15);
  background: linear-gradient(145deg, #f0f0ff, #f8f9fa);
}

html[data-bs-theme="dark"] .oa-summary-card {
  background: linear-gradient(145deg, #1a1a2e, #181a1e);
  border-color: rgba(99, 102, 241, 0.25);
}

.oa-summary-metrics {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.oa-summary-metric {
  flex: 1;
  min-width: 100px;
  background: rgba(99, 102, 241, 0.06);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.2s ease;
}

.oa-summary-metric:hover {
  transform: translateY(-2px);
}

html[data-bs-theme="dark"] .oa-summary-metric {
  background: rgba(99, 102, 241, 0.1);
}

.oa-summary-metric-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #4f46e5;
  line-height: 1.2;
}

html[data-bs-theme="dark"] .oa-summary-metric-value {
  color: #818cf8;
}

.oa-summary-metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
}

html[data-bs-theme="dark"] .oa-summary-metric-label {
  color: #999;
}

.oa-summary-metric-change {
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 1px 6px;
}

.oa-summary-metric-change.positive {
  color: #059669;
  background: rgba(16, 185, 129, 0.1);
}

.oa-summary-metric-change.negative {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.1);
}

.oa-summary-metric-change.neutral {
  color: #6b7280;
  background: rgba(107, 114, 128, 0.1);
}

.oa-summary-text {
  background: rgba(99, 102, 241, 0.04);
  border-radius: 12px;
  padding: 20px;
  font-size: 0.9rem;
  line-height: 1.7;
  color: #374151;
  white-space: pre-wrap;
}

html[data-bs-theme="dark"] .oa-summary-text {
  background: rgba(99, 102, 241, 0.06);
  color: #d1d5db;
}

.oa-summary-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.oa-typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.oa-typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6366f1;
  animation: oaTypingBounce 1.4s infinite ease-in-out both;
}

.oa-typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.oa-typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.oa-typing-dots span:nth-child(3) {
  animation-delay: 0s;
}

@keyframes oaTypingBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.oa-select-mini {
  appearance: none;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 8px;
  padding: 5px 28px 5px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #4f46e5;
  cursor: pointer;
  transition: all 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%234f46e5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.oa-select-mini:hover {
  background-color: rgba(99, 102, 241, 0.14);
}

.oa-select-mini:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

html[data-bs-theme="dark"] .oa-select-mini {
  background-color: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a5b4fc'/%3E%3C/svg%3E");
}

.oa-btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: rgba(99, 102, 241, 0.08);
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.oa-btn-icon:hover {
  background: rgba(99, 102, 241, 0.16);
  transform: rotate(90deg);
}

html[data-bs-theme="dark"] .oa-btn-icon {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}

@media (max-width: 480px) {
  .oa-summary-metrics {
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .oa-summary-metric {
    min-width: 70px;
    padding: 10px 8px;
  }
}

@media (max-width: 480px) {
  .oa-summary-metric-value {
    font-size: 1.2rem;
  }
}

/* Bottone testuale (es. export CSV) — a differenza di .oa-refresh-btn (icona quadrata) */

.oa-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(142, 9, 249, 0.25);
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.oa-export-btn:hover {
  background: rgba(142, 9, 249, 0.08);
  border-color: rgba(142, 9, 249, 0.45);
}

.oa-export-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Didascalia esplicativa sopra ogni grafico */

.oa-chart-caption {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--bs-secondary-color, #6c757d);
  margin: 12px 0 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.oa-chart-caption i {
  color: var(--ap-primary, #8e09f9);
  font-size: 0.75rem;
}

