html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ── Tickets UI ─────────────────────────────────────────────── */

.tickets-page {
  --ticket-header-bg: #2d3748;
  --ticket-header-text: #f8fafc;
  --ticket-accent: #3b82f6;
  --ticket-row-hover: #f8fafc;
}

.tickets-header {
  margin-bottom: 1.25rem;
}

.tickets-title {
  font-size: 1.65rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tickets-subtitle {
  font-size: 0.95rem;
}

.tickets-count-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 600;
}

.tickets-table-card.tickets-loading {
  opacity: 0.55;
  pointer-events: none;
}

.tickets-filter-select:disabled {
  cursor: wait;
}

.tickets-toolbar {
  margin-bottom: 0.75rem;
  border-radius: 0.75rem;
}

.tickets-filters {
  margin-bottom: 1rem;
  border-radius: 0.75rem;
}

.tickets-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.tickets-filters-row-secondary {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed #e2e8f0;
}

.tickets-filters-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
  padding-right: 0.25rem;
}

.tickets-filters-align-spacer {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  white-space: nowrap;
  padding-right: 0.25rem;
  visibility: hidden;
  pointer-events: none;
  user-select: none;
}

.tickets-filter-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.tickets-filter-label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}

.tickets-filter-select {
  min-width: 9rem;
  max-width: 12rem;
  border-color: #dbe3ee;
  font-size: 0.85rem;
}

.tickets-filter-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 0.15rem rgba(59, 130, 246, 0.15);
}

@media (max-width: 992px) {
  .tickets-filter-select {
    min-width: 8rem;
    max-width: none;
  }
}

.tickets-table-card {
  border-radius: 0.75rem;
  overflow: hidden;
}

.tickets-table {
  table-layout: fixed;
  width: 100%;
}

.tickets-table thead th {
  background: var(--ticket-header-bg);
  color: var(--ticket-header-text);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: none;
  padding: 0.85rem 0.75rem;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.tickets-th-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 0.35rem;
}

.tickets-th-sortable.is-active .tickets-th-label {
  color: #fff;
}

.tickets-th-sort-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: calc(100% - 10px);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  cursor: pointer;
}

.tickets-th-sort-btn .tickets-th-label {
  flex: 1;
  min-width: 0;
  padding-right: 0;
}

.tickets-th-sort-btn-center {
  justify-content: center;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.tickets-th-sort-btn:hover .tickets-th-label,
.tickets-th-sortable.is-active .tickets-th-sort-btn .tickets-th-label {
  color: #e2e8f0;
}

.tickets-sort-icon {
  flex-shrink: 0;
  font-size: 0.8rem;
  opacity: 0.9;
}

.tickets-sort-icon-muted {
  opacity: 0.45;
}

.tickets-th-sortable.is-active .tickets-sort-icon {
  opacity: 1;
  color: #93c5fd;
}

.tickets-col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  touch-action: none;
  z-index: 2;
}

.tickets-col-resizer::after {
  content: "";
  position: absolute;
  top: 18%;
  bottom: 18%;
  right: 3px;
  width: 2px;
  border-radius: 1px;
  background: rgba(248, 250, 252, 0.35);
  transition: background-color 0.15s ease;
}

.tickets-col-resizer:hover::after,
.tickets-col-resizer.is-active::after {
  background: #60a5fa;
}

body.tickets-col-resizing {
  cursor: col-resize !important;
  user-select: none;
}

body.tickets-col-resizing * {
  cursor: col-resize !important;
}

.tickets-table tbody td {
  padding: 0.9rem 0.75rem;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
  overflow: hidden;
}

.tickets-table tbody td:last-child {
  overflow: visible;
}

.tickets-row:hover {
  background: var(--ticket-row-hover);
}

.tickets-empty {
  padding: 3rem 1rem !important;
  color: #64748b;
}

.ticket-number-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ticket-number-badge {
  display: inline-block;
  width: fit-content;
  padding: 0.3rem 0.65rem;
  border-radius: 0.45rem;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.2;
}

.ticket-id-meta {
  color: #94a3b8;
  font-size: 0.72rem;
}

.ticket-subject {
  font-weight: 600;
  color: #1e293b;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-client {
  color: #64748b;
  font-size: 0.9rem;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-pill {
  display: inline-block;
  padding: 0.28rem 0.6rem;
  border-radius: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.ticket-pill-status-default,
.ticket-pill-priority-normal {
  background: #475569;
  color: #fff;
}

.ticket-pill-status-open {
  background: #0ea5e9;
  color: #fff;
}

.ticket-pill-status-progress {
  background: #8b5cf6;
  color: #fff;
}

.ticket-pill-status-closed {
  background: #64748b;
  color: #fff;
}

.ticket-pill-priority-high {
  background: #f97316;
  color: #fff;
}

.ticket-pill-priority-critical {
  background: #ef4444;
  color: #fff;
}

.ticket-pill-priority-low {
  background: #94a3b8;
  color: #fff;
}

.ticket-ts-code {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 0.35rem;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
}

.ticket-datetime {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: #64748b;
  white-space: nowrap;
}

.ticket-indexed-yes {
  color: #22c55e;
  font-size: 1.1rem;
}

.ticket-indexed-no {
  color: #cbd5e1;
  font-size: 1.1rem;
}

.ticket-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
}

.btn-ticket-view,
.btn-ticket-rag {
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.45rem;
  border: none;
  color: #fff;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn-ticket-view {
  background: #7c3aed;
}

.btn-ticket-rag {
  background: #10b981;
}

.btn-ticket-view:hover,
.btn-ticket-rag:hover {
  color: #fff;
  transform: translateY(-1px);
  opacity: 0.92;
}

/* Detail page */

.ticket-detail-hero {
  border-radius: 0.75rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.ticket-detail-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
}

.ticket-description {
  white-space: pre-wrap;
  color: #334155;
  line-height: 1.6;
  font-size: 0.95rem;
}

.ticket-info-tile {
  border-radius: 0.65rem;
}

.ticket-info-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.ticket-info-value {
  color: #1e293b;
  font-weight: 500;
}

.ticket-rag-panel {
  border-radius: 0.75rem;
  position: sticky;
  top: 1rem;
}

.ticket-rag-status {
  font-size: 0.9rem;
  color: #64748b;
}

.ticket-rag-response-link.is-loading {
  pointer-events: none;
  cursor: wait;
  opacity: 0.85;
}

.ticket-number-link {
  text-decoration: none;
  display: inline-block;
}

.ticket-number-link-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ticket-number-link.is-loading {
  pointer-events: none;
  cursor: wait;
}

.ticket-number-link.is-loading .ticket-number-badge {
  opacity: 0.85;
}

.ticket-number-link:hover .ticket-number-badge {
  filter: brightness(1.08);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.ticket-comments-timeline {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: #eef2f7;
  border-radius: 0.5rem;
  padding: 1rem;
}

.ticket-comment-date-marker {
  display: inline-block;
  align-self: flex-start;
  padding: 0.2rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.25rem;
  background: #fff;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: -0.35rem;
  margin-left: 0.15rem;
}

.ticket-comment-subject-bar {
  padding: 0.65rem 1rem;
  background: #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ticket-comment-card {
  border: 1px solid #cbd5e1;
  border-radius: 0.35rem;
  padding: 0;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.ticket-comment-internal {
  border-color: #fcd34d;
}

.ticket-comment-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.85rem 1rem 0.75rem;
}

.ticket-comment-top-left {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.ticket-comment-top-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.ticket-comment-number {
  font-size: 1.35rem;
  font-weight: 700;
  color: #334155;
  line-height: 1;
}

.ticket-comment-visibility {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ticket-comment-visibility-public {
  background: #16a34a;
  color: #fff;
}

.ticket-comment-visibility-internal {
  background: #f59e0b;
  color: #fff;
}

.ticket-comment-divider {
  margin: 0;
  border: 0;
  border-top: 1px solid #e2e8f0;
  opacity: 1;
}

.ticket-comment-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #dbeafe;
  color: #2563eb;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.ticket-comment-name {
  font-weight: 600;
  color: #2563eb;
  line-height: 1.3;
  font-size: 0.95rem;
}

.ticket-comment-meta {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.ticket-comment-type-label {
  padding: 0 1rem 0.75rem;
  font-size: 0.75rem;
  color: #94a3b8;
  font-style: italic;
}

.ticket-comment-body {
  color: #334155;
  line-height: 1.55;
  font-size: 0.92rem;
  padding: 0.85rem 1rem 1rem;
}

.ticket-comment-body-html {
  white-space: normal;
  word-break: break-word;
}

.ticket-comment-body-html p {
  margin-bottom: 0.75rem;
}

.ticket-comment-body-html p:last-child {
  margin-bottom: 0;
}

.ticket-comment-body-html ul,
.ticket-comment-body-html ol {
  margin-bottom: 0.75rem;
  padding-left: 1.25rem;
}

.ticket-comment-body-html img {
  max-width: 100%;
  height: auto;
}

.ticket-comment-attachments {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.5rem 1rem 1rem;
  border-top: 1px solid #eef2f7;
  margin-top: 0.25rem;
}

.ticket-comment-attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #2563eb;
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.4;
}

.ticket-comment-attachment-link .bi-paperclip {
  color: #94a3b8;
  font-size: 0.95rem;
}

.ticket-comment-attachment-link span {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ticket-comment-attachment-link:hover {
  color: #1d4ed8;
}

.ticket-comment-attachment-link:hover .bi-paperclip {
  color: #64748b;
}

.ticket-comment-body-html table {
  max-width: 100%;
}

.ticket-comment-body-system {
  font-style: italic;
}

.ticket-comment-footer {
  margin: 0 1rem 0.85rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #e2e8f0;
}

.ticket-comment-images-action {
  margin: 0 1rem 1rem;
  padding-top: 0.65rem;
  border-top: 1px dashed #e2e8f0;
}

.ticket-comment-images-btn {
  font-weight: 600;
}

.comment-image-ocr-panel {
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #f8fafc;
  padding: 1rem;
  margin-bottom: 1rem;
}

.comment-image-ocr-panel:last-child {
  margin-bottom: 0;
}

.comment-image-ocr-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.comment-image-ocr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.comment-image-ocr-title {
  color: #1e293b;
  font-weight: 700;
}

.comment-image-ocr-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.75rem;
  border-radius: 0.65rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  overflow: auto;
  max-height: 28rem;
}

.comment-image-ocr-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 0.35rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.comment-image-ocr-result {
  margin-top: 0.85rem;
}

.comment-image-ocr-result-vision {
  margin-top: 0.65rem;
}

.comment-image-ocr-result-opencv {
  margin-top: 0.65rem;
}

.comment-image-ocr-result-opencv-vision {
  margin-top: 0.65rem;
}

.comment-image-ocr-result-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.comment-image-ocr-result-text {
  margin: 0;
  padding: 0.85rem;
  border-radius: 0.55rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1e293b;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 16rem;
  overflow: auto;
}

.ticket-comments-empty {
  color: #94a3b8;
}

@media (min-width: 1400px) {
  .ticket-subject {
    max-width: none;
  }
}

@media (max-width: 1200px) {
  .ticket-subject {
    max-width: 200px;
  }
}

.rag-section-header {
  background: #e2e8f0;
  color: #334155;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid #cbd5e1;
  padding: 0.75rem 1rem;
}

.rag-ask-page .rag-section-header,
.rag-response-page .rag-section-header {
  letter-spacing: 0.01em;
}

.rag-context-item-header {
  background: #e2e8f0;
  color: #475569;
  font-weight: 600;
  font-size: 0.82rem;
  border-radius: 0.35rem;
  padding: 0.4rem 0.65rem;
}

.rag-answer,
.rag-answer-text {
  white-space: pre-wrap;
  line-height: 1.6;
  color: #1e293b;
}

#gptAnswerCard .card-body {
  padding-bottom: 0.65rem;
}

.rag-ts-action-card .rag-ts-action-rating {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e2e8f0;
  margin-bottom: 0;
}

.rag-grounding-rule-id {
  cursor: help;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.15em;
  color: #0f766e;
}

.rag-grounding-rule-id:hover,
.rag-grounding-rule-id:focus {
  color: #0d9488;
  outline: none;
}

.rag-grounding-tooltip .tooltip-inner {
  max-width: 320px;
  text-align: left;
  font-size: 0.8125rem;
  line-height: 1.45;
  padding: 0.5rem 0.65rem;
}

.rag-grounding-check-item strong {
  font-weight: 600;
}

.rag-answer-rating-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.rag-answer-rating-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
}

.rag-answer-not-answerable {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.rag-rating-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #64748b;
  line-height: 1;
}

.rag-rating-btn .bi {
  font-size: 1.35rem;
  line-height: 1;
}

.rag-rating-btn:hover:not(:disabled) {
  background: #f8fafc;
  color: #334155;
}

.rag-rating-btn.active.rag-rating-up {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}

.rag-rating-btn.active.rag-rating-down {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.rag-rating-btn.rag-rating-not-answerable {
  color: #dc2626;
  border-color: #fecaca;
}

.rag-rating-btn.rag-rating-not-answerable:hover:not(:disabled) {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.rag-rating-btn.active.rag-rating-not-answerable {
  background: #fee2e2;
  border-color: #f87171;
  color: #b91c1c;
}

.rag-rating-btn:disabled {
  opacity: 0.85;
  cursor: default;
}

.rag-rating-feedback {
  color: #15803d;
}

.rag-gpt-section {
  scroll-margin-top: 1rem;
}

.first-comment-counts-loading .indexed-summary-card.first-comment-counts-pending {
  pointer-events: none;
  cursor: wait;
  opacity: 0.75;
}

.first-comment-counts-loading [data-count-display] {
  min-height: 2.5rem;
  display: flex;
  align-items: center;
}

.rag-gpt-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 1.25rem;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 0.5rem;
  text-align: center;
}

.rag-gpt-processing-spinner {
  width: 2.5rem;
  height: 2.5rem;
}

.rag-gpt-processing-title {
  font-weight: 600;
  color: #1e40af;
}

.rag-index-progress-wrap {
  max-width: 28rem;
  margin-top: 0.25rem;
}

.rag-index-progress {
  height: 1.25rem;
}

.indexed-summary-card {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.indexed-summary-card:hover,
.indexed-summary-card:focus {
  transform: translateY(-2px);
  box-shadow: 0 0.35rem 0.85rem rgba(22, 101, 52, 0.15);
  outline: none;
}

.indexed-summary-card:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.35);
}

.indexed-by-month-modal {
  max-width: 32rem;
}

.indexed-by-month-table thead th {
  background-color: #f8fafc;
  border-bottom-width: 2px;
  white-space: nowrap;
}

.indexed-by-month-table tbody td {
  vertical-align: middle;
}

.rag-threshold-compare-grid {
  align-items: stretch;
}

.rag-threshold-column {
  border-top: 3px solid #2563eb;
}

.rag-threshold-context-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 16rem;
  overflow: auto;
}

.rag-threshold-context-item .rag-context-item-summary {
  padding: 0.45rem 0.55rem;
  font-size: 0.88rem;
}

.rag-threshold-answer-text {
  max-height: 18rem;
  overflow: auto;
  font-size: 0.92rem;
}

.rag-rated-answers-card {
  border-left: 4px solid #f59e0b;
}

.rag-rated-answers-list {
  display: flex;
  flex-direction: column;
}

.rag-rated-answer-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}

.rag-rated-answer-item .rag-answer-rating {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
}

.rag-rated-answer-date {
  margin-top: 0.35rem;
  padding-left: 0.1rem;
}

.rag-rated-answer-item:last-child {
  border-bottom: 0;
}

.rag-rated-answer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}

.rag-rated-badge {
  font-weight: 600;
}

.rag-rated-badge-good {
  background: #dcfce7;
  color: #15803d;
}

.rag-rated-badge-bad {
  background: #fee2e2;
  color: #b91c1c;
}

.rag-rated-answer-text {
  white-space: pre-wrap;
  line-height: 1.55;
  color: #1e293b;
  font-size: 0.95rem;
}

.rag-rated-answer-text-negative {
  color: #64748b;
}

.rag-rated-answer-text-not-answerable {
  color: #b91c1c;
}

.rag-response-page .rag-reference-card {
  border-left: 4px solid #64748b;
}

.rag-response-page .rag-context-card {
  border-left: 4px solid #2563eb;
}

.rag-reference-meta {
  font-size: 0.85rem;
}

.rag-context-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rag-context-item {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #f8fafc;
  overflow: hidden;
}

.rag-context-item-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  list-style: none;
  background: #e2e8f0;
  font-weight: 600;
  font-size: 0.88rem;
  color: #334155;
  user-select: none;
}

.rag-context-item-summary::-webkit-details-marker {
  display: none;
}

.rag-context-summary-main {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.rag-context-chevron {
  color: #64748b;
  font-size: 0.8rem;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.rag-context-item[open] .rag-context-chevron {
  transform: rotate(90deg);
}

.rag-context-ticket-link {
  color: #1e293b;
  text-decoration: none;
  font-weight: 600;
}

.rag-context-ticket-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

.rag-context-item-body {
  padding: 0.75rem 0.85rem 0.85rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.rag-score-badge {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
}

.rag-context-snippet {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #334155;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  padding: 0.75rem;
}

.home-page {
  max-width: 1140px;
  margin: 0 auto;
  padding-bottom: 1rem;
}

.home-hero {
  position: relative;
  overflow: hidden;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 45%, #db2777 100%);
  color: #fff;
  box-shadow: 0 20px 50px rgba(79, 70, 229, 0.35);
}

.home-hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  pointer-events: none;
}

.home-hero-glow-1 {
  width: 280px;
  height: 280px;
  top: -80px;
  right: -40px;
  background: #22d3ee;
}

.home-hero-glow-2 {
  width: 220px;
  height: 220px;
  bottom: -60px;
  left: 10%;
  background: #fbbf24;
}

.home-hero-inner {
  position: relative;
  z-index: 1;
  padding: 2.5rem 1.75rem;
}

@media (min-width: 992px) {
  .home-hero-inner {
    padding: 3rem 2.5rem;
  }
}

.home-hero-badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  margin-bottom: 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.85rem;
  font-weight: 600;
  backdrop-filter: blur(6px);
}

.home-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
}

.home-hero-lead {
  font-size: 1.05rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.92);
  max-width: 38rem;
}

.home-hero-btn {
  font-weight: 600;
  border-radius: 0.65rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.home-hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.home-stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
}

.home-stat-card i {
  font-size: 1.35rem;
}

.home-stat-card-violet i { color: #ddd6fe; }
.home-stat-card-cyan i { color: #a5f3fc; }
.home-stat-card-amber i { color: #fde68a; }
.home-stat-card-rose i { color: #fecdd3; }

.home-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1.25rem;
}

.home-section-title i {
  color: #6366f1;
}

.home-feature-card {
  height: 100%;
  padding: 1.25rem 1.25rem 1.15rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  background: #fff;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.home-feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
}

.home-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.85rem;
  border-radius: 0.65rem;
  font-size: 1.15rem;
}

.home-feature-card h3 {
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.45rem;
}

.home-feature-card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #64748b;
}

.home-feature-card-blue { border-top: 4px solid #3b82f6; }
.home-feature-card-blue .home-feature-icon { background: #dbeafe; color: #2563eb; }

.home-feature-card-indigo { border-top: 4px solid #6366f1; }
.home-feature-card-indigo .home-feature-icon { background: #e0e7ff; color: #4f46e5; }

.home-feature-card-violet { border-top: 4px solid #8b5cf6; }
.home-feature-card-violet .home-feature-icon { background: #ede9fe; color: #7c3aed; }

.home-feature-card-teal { border-top: 4px solid #14b8a6; }
.home-feature-card-teal .home-feature-icon { background: #ccfbf1; color: #0d9488; }

.home-feature-card-green { border-top: 4px solid #22c55e; }
.home-feature-card-green .home-feature-icon { background: #dcfce7; color: #16a34a; }

.home-feature-card-orange { border-top: 4px solid #f97316; }
.home-feature-card-orange .home-feature-icon { background: #ffedd5; color: #ea580c; }

.home-feature-card-rose { border-top: 4px solid #f43f5e; }
.home-feature-card-rose .home-feature-icon { background: #ffe4e6; color: #e11d48; }

.home-feature-card-slate { border-top: 4px solid #475569; }
.home-feature-card-slate .home-feature-icon { background: #f1f5f9; color: #334155; }

.home-feature-card a,
a .home-feature-card {
  color: inherit;
}

.home-stack-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.home-stack-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.home-stack-pill-net { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.home-stack-pill-db { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.home-stack-pill-ef { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.home-stack-pill-id { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.home-stack-pill-ui { background: #fce7f3; color: #be185d; border-color: #fbcfe8; }
.home-stack-pill-ai { background: #f3e8ff; color: #7e22ce; border-color: #e9d5ff; }

.home-panel {
  border-radius: 1.1rem;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
}

.home-panel-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.1rem 1.35rem;
  color: #fff;
  font-weight: 700;
}

.home-panel-header i {
  font-size: 1.25rem;
}

.home-panel-databases .home-panel-header {
  background: linear-gradient(90deg, #0891b2, #0284c7);
}

.home-panel-integrations .home-panel-header {
  background: linear-gradient(90deg, #d97706, #ea580c);
}

.home-panel-body {
  padding: 1.25rem 1.35rem 1.35rem;
}

.home-db-card {
  position: relative;
  padding: 1rem 1rem 1rem 1.15rem;
  margin-bottom: 0.85rem;
  border-radius: 0.75rem;
  border-left: 4px solid;
  background: #f8fafc;
}

.home-db-card-label {
  display: inline-block;
  margin-bottom: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.home-db-card h3 {
  color: #1e293b;
  margin-bottom: 0.35rem;
}

.home-db-card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #64748b;
}

.home-db-card-app {
  border-left-color: #22c55e;
  background: linear-gradient(90deg, #f0fdf4, #f8fafc);
}

.home-db-card-app .home-db-card-label {
  background: #dcfce7;
  color: #15803d;
}

.home-db-card-ts {
  border-left-color: #3b82f6;
  background: linear-gradient(90deg, #eff6ff, #f8fafc);
}

.home-db-card-ts .home-db-card-label {
  background: #dbeafe;
  color: #1d4ed8;
}

.home-db-card-vec {
  border-left-color: #a855f7;
  background: linear-gradient(90deg, #faf5ff, #f8fafc);
}

.home-db-card-vec .home-db-card-label {
  background: #f3e8ff;
  color: #7e22ce;
}

.home-int-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem;
  margin-bottom: 0.85rem;
  border-radius: 0.75rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.home-int-card:nth-child(2) {
  background: #f5f3ff;
  border-color: #ddd6fe;
}

.home-int-card:nth-child(3) {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.home-int-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  font-size: 1.2rem;
  color: #fff;
}

.home-int-icon-ts { background: linear-gradient(135deg, #3b82f6, #6366f1); }
.home-int-icon-ai { background: linear-gradient(135deg, #8b5cf6, #d946ef); }
.home-int-icon-grounding { background: linear-gradient(135deg, #f43f5e, #fb7185); }
.home-int-icon-tools { background: linear-gradient(135deg, #0ea5e9, #06b6d4); }

.home-int-card h3 {
  color: #1e293b;
}

.home-int-card p {
  font-size: 0.88rem;
  line-height: 1.55;
  color: #64748b;
}

.home-link {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

.home-link:hover {
  text-decoration: underline;
}

.home-cta {
  position: relative;
  overflow: hidden;
  border-radius: 1.1rem;
  background: linear-gradient(135deg, #0f766e 0%, #059669 50%, #10b981 100%);
  color: #fff;
  box-shadow: 0 16px 40px rgba(5, 150, 105, 0.3);
}

.home-cta-glow {
  position: absolute;
  top: -40%;
  right: -10%;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.home-cta-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.75rem 1.5rem;
}

@media (min-width: 768px) {
  .home-cta-inner {
    padding: 2rem 2rem;
  }
}

.home-cta-inner p {
  color: rgba(255, 255, 255, 0.9);
  max-width: 28rem;
}

.home-cta .btn-light {
  color: #047857;
  font-weight: 600;
}

.home-cta .btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* API documentation */
.api-docs-page {
  max-width: 960px;
  margin: 0 auto;
}

.api-docs-header {
  padding: 1.5rem 1.75rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  border: 1px solid #e2e8f0;
}

.api-docs-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #6366f1;
  text-decoration: none;
  margin-bottom: 0.75rem;
}

.api-docs-back-link:hover {
  color: #4f46e5;
}

.api-docs-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.75rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 0.75rem;
}

.api-docs-title i {
  color: #6366f1;
}

.api-docs-intro {
  color: #475569;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.api-docs-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.api-docs-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.api-docs-group-header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e2e8f0;
}

.api-endpoint-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.api-endpoint-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.api-method {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.api-method-get {
  background: #dcfce7;
  color: #15803d;
}

.api-method-post {
  background: #dbeafe;
  color: #1d4ed8;
}

.api-endpoint-path {
  font-size: 0.95rem;
  color: #0f172a;
  word-break: break-all;
}

.api-endpoint-summary {
  color: #334155;
  margin-bottom: 0.5rem;
  line-height: 1.55;
}

.api-endpoint-notes,
.api-endpoint-csrf {
  font-size: 0.88rem;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.api-endpoint-notes i,
.api-endpoint-csrf i {
  color: #6366f1;
}

.api-fields-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin: 1rem 0 0.5rem;
}

.api-field-table {
  font-size: 0.88rem;
}

.api-field-table thead th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  border-bottom-width: 1px;
}

.api-field-table code {
  font-size: 0.82rem;
  color: #7c3aed;
}

.api-field-type {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  color: #0f766e;
}

.rag-ts-action-card {
  border-left: 4px solid #64748b;
}

.rag-ts-action-comment {
  margin-bottom: 0;
}