.reports-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Section grouping ─────────────────────────────────────── */

.reports-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reports-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.reports-section-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 17px;
  color: #fff;
  flex-shrink: 0;
}

.reports-section-icon.accent { background: var(--accent); }
.reports-section-icon.warm   { background: var(--accent-warm); }
.reports-section-icon.sky    { background: var(--accent-sky); }
.reports-section-icon.gold   { background: var(--accent-gold); }

.reports-section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 2px;
  letter-spacing: -0.01em;
}

.reports-section-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.reports-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.reports-title h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.reports-title p {
  margin: 0;
  color: var(--muted);
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.reports-filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.reports-date label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}

/* ── KPI kaarten ────────────────────────────────────────────── */

.report-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.report-kpi {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 16px 18px 14px;
  border: 1px solid var(--border);
  border-top: 3px solid transparent;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.report-kpis .report-kpi:nth-child(4n+1) { border-top-color: var(--accent); }
.report-kpis .report-kpi:nth-child(4n+2) { border-top-color: var(--accent-warm); }
.report-kpis .report-kpi:nth-child(4n+3) { border-top-color: var(--accent-sky); }
.report-kpis .report-kpi:nth-child(4n+4) { border-top-color: var(--accent-gold); }

.report-kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.report-kpi-value {
  font-size: 30px;
  font-weight: 800;
  margin-top: 6px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.report-kpi-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  flex: 1;
}

.report-kpi-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.report-drill-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--accent-strong);
  background: var(--accent-ghost);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
  white-space: nowrap;
}

.report-drill-link:hover {
  background: var(--accent-ghost-strong);
  color: var(--accent);
}

.report-charts {
  margin-top: 0;
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 0;
}

.report-card-wide {
  background: var(--card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.report-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.report-card-header > strong {
  font-size: 13px;
  font-weight: 700;
}

.report-pill {
  background: var(--accent-ghost-strong);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.report-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6px, 1fr));
  gap: 5px;
  align-items: end;
  height: 190px;
  position: relative;
  padding-bottom: 1px;
  /* Subtiele horizontale gidslijnen op 25 / 50 / 75 % */
  background-image:
    linear-gradient(to bottom, transparent calc(25% - 0.5px), var(--border) 25%, transparent calc(25% + 0.5px)),
    linear-gradient(to bottom, transparent calc(50% - 0.5px), var(--border) 50%, transparent calc(50% + 0.5px)),
    linear-gradient(to bottom, transparent calc(75% - 0.5px), var(--border) 75%, transparent calc(75% + 0.5px));
}

.report-chart::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--border-strong);
  pointer-events: none;
}

.report-bar {
  height: 100%;
  display: flex;
  align-items: flex-end;
  position: relative;
  cursor: default;
}

.report-bar span {
  display: block;
  width: 100%;
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--accent) 78%, white) 0%,
    var(--accent) 45%,
    var(--accent-sky) 100%
  );
  border-radius: 4px 4px 1px 1px;
  min-height: 4px;
  transition: filter 150ms ease, box-shadow 150ms ease;
  transform-origin: bottom center;
  animation: barGrow 520ms cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.report-bar:hover span {
  filter: brightness(1.12) saturate(1.1);
  box-shadow:
    0 0 0 1px color-mix(in oklab, var(--accent) 28%, transparent),
    0 6px 20px color-mix(in oklab, var(--accent) 32%, transparent);
}

.report-bar-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(var(--bar-height, 0%) + 8px);
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  pointer-events: none;
  background: var(--text);
  color: var(--card);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 7px;
  border-radius: 6px;
  white-space: nowrap;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 2;
}

.report-bar-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--text);
}

.report-bar:hover .report-bar-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.report-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 7px;
}

@keyframes barGrow {
  from {
    transform: scaleY(0);
    opacity: 0.3;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

.report-empty-state {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: var(--accent-ghost);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.report-table,
.report-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-ghost);
}

.report-row-link {
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.report-row-link:hover {
  background: var(--accent-ghost-strong);
  border-color: var(--accent-strong);
  transform: translateY(-1px);
}

.report-row.compact {
  padding: 8px 10px;
}

.report-sub {
  font-size: 12px;
  color: var(--muted);
}

.report-value {
  font-weight: 700;
}

.report-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-chat-row {
  display: flex;
}

.report-chat-row.user {
  justify-content: flex-end;
}

.report-chat-row.assistant {
  justify-content: flex-start;
}

.report-chat-bubble {
  max-width: min(84%, 760px);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 9px 11px;
  box-shadow: 0 2px 6px color-mix(in oklab, var(--text) 7%, transparent);
}

.report-chat-bubble.user {
  background: color-mix(in oklab, var(--accent) 14%, white);
  border-color: color-mix(in oklab, var(--accent) 26%, var(--border));
}

.report-chat-bubble.assistant {
  background: color-mix(in oklab, var(--accent-sky) 12%, white);
  border-color: color-mix(in oklab, var(--accent-sky) 22%, var(--border));
}

.report-chat-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--muted);
}

.report-chat-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.report-chat-focus-label {
  display: inline-flex;
  align-items: center;
  margin-bottom: 6px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.report-chat-focus-label.question {
  color: #7b5a12;
  background: #fff7e8;
  border: 1px solid #ead2a2;
}

.report-chat-focus-label.answer {
  color: #b34848;
  background: #fdf3f3;
  border: 1px solid #e2b6b6;
}

.report-chat-bubble.flagged-question {
  border-color: #dec183;
  box-shadow: 0 0 0 1px #f6e6c6;
}

.report-chat-bubble.flagged-answer {
  border-color: #dca1a1;
  box-shadow: 0 0 0 1px #f6dede;
}

.report-chat-feedback-badge {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
}

.report-chat-feedback-badge.negative {
  color: #b34848;
  background: #fdf3f3;
  border: 1px solid #e2b6b6;
}

.report-chat-feedback-badge.positive {
  color: #2e8b57;
  background: #f1f9f4;
  border: 1px solid #9cc8af;
}

.report-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: transform 160ms ease, box-shadow 160ms ease;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-mid);
  position: relative;
  overflow: hidden;
}

.report-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-float);
  background: linear-gradient(0deg, var(--accent-ghost), var(--accent-ghost)), var(--card);
}

.report-card-disabled {
  cursor: not-allowed;
  opacity: 0.9;
}

.report-card-disabled:hover {
  transform: none;
  box-shadow: var(--shadow-mid);
  background: var(--card);
}

.report-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 24, 0.45);
  display: grid;
  place-items: center;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: #fff;
  backdrop-filter: blur(2px);
}

.report-overlay-upgrade {
  text-transform: none;
  letter-spacing: normal;
  font-size: 13px;
}

.report-upgrade-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 14px;
}

.report-upgrade-message {
  line-height: 1.35;
}

.report-upgrade-action {
  font-weight: 600;
}

.report-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: #fff;
}

.report-icon.accent { background: var(--accent); }
.report-icon.warm { background: var(--accent-warm); }
.report-icon.sky { background: var(--accent-sky); }
.report-icon.gold { background: var(--accent-gold); }

.report-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-meta strong {
  font-size: 14px;
}

.report-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.report-author {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.report-link {
  margin-left: auto;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  text-decoration: none;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes skeletonPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.85; }
}

.report-drill-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 24, 0.48);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1080;
  display: grid;
  place-items: center;
  padding: 16px;
  animation: modalFadeIn 180ms ease;
}

.report-drill-modal {
  width: min(980px, 100%);
  max-height: min(85vh, 860px);
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 24px 60px rgba(10, 14, 24, 0.36), 0 4px 16px rgba(10, 14, 24, 0.14);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  animation: modalSlideIn 240ms cubic-bezier(0.34, 1.2, 0.64, 1);
  position: relative;
}

.report-drill-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-warm, var(--accent)));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 1;
}

.report-drill-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 16px 18px 14px;
}

.report-drill-header-main {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 5px;
}

.report-drill-header-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.report-drill-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.report-drill-header p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}


.report-drill-count {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-ghost);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  white-space: nowrap;
}

.report-drill-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.report-drill-body {
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 16px;
}

.report-drill-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.report-drill-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-drill-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--accent-ghost);
  transition: background 140ms ease, border-color 140ms ease;
}

.report-drill-row:hover {
  background: var(--accent-ghost-strong);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.report-drill-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.report-drill-main strong {
  overflow-wrap: anywhere;
}

.report-drill-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 170px;
  text-align: right;
}

.report-drill-skel {
  background: var(--border);
  border-radius: 4px;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

.report-drill-title-skel {
  height: 16px;
  width: 52%;
}

.report-drill-desc-skel {
  height: 12px;
  width: 68%;
}

@media (max-width: 1000px) {
  .reports-grid {
    grid-template-columns: 1fr;
  }
}

.report-card {
  border-radius: var(--radius-lg);
}

.report-icon {
  border-radius: var(--radius-md);
}

@media (max-width: 1100px) {
  .report-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .reports-page {
    gap: 20px;
  }

  .reports-section-header {
    gap: 10px;
  }

  .reports-section-title {
    font-size: 14px;
  }

  .reports-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .reports-title h1 {
    margin: 0 0 4px;
    font-size: 24px;
  }

  .reports-title p {
    font-size: 14px;
    line-height: 1.35;
  }

  .reports-filters {
    width: 100%;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
  }

  .reports-date {
    width: min(200px, 100%);
  }

  .reports-date label {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .reports-date .form-control {
    min-height: 34px;
    padding: 5px 9px;
    font-size: 13px;
  }

  .reports-filters .btn {
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.2;
  }

  .reports-filters .btn-with-icon {
    gap: 5px;
  }

  .report-drill-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .report-drill-meta {
    width: 100%;
    min-width: 0;
    justify-items: start;
    text-align: left;
  }
}

@media (max-width: 460px) {
  .reports-title h1 {
    font-size: 22px;
  }

  .reports-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .reports-date {
    width: 100%;
  }

  .reports-filters .btn {
    width: 100%;
    justify-content: center;
    padding: 7px 10px;
    font-size: 12px;
  }
}
