#reportes.phase5-reports-audit {
  --phase5-primary: var(--brand-primary, var(--yellow, #F2D200));
  --phase5-secondary: var(--brand-secondary, var(--black, #171717));
  --phase5-surface: var(--brand-surface, var(--white, #FFFFFF));
  --phase5-canvas: var(--brand-bg, var(--bg, #F5F5F5));
  --phase5-ink: var(--brand-text, var(--text, #1E1E1E));
  --phase5-border: var(--border, #D9D9D9);
  --phase5-muted: #555555;
  --phase5-success: var(--success, #1F8B4C);
  --phase5-warning: var(--warning, #B7791F);
  --phase5-error: var(--error, #B42318);
  --phase5-info: #2563EB;
  display: grid;
  gap: 18px;
}

#reportes .phase5-report-hero {
  position: relative;
  align-items: flex-start;
  margin: 0;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--phase5-border);
  border-radius: 14px;
  background: var(--phase5-surface);
  box-shadow: var(--shadow);
}

#reportes .phase5-report-hero {
  box-shadow: inset 0 3px 0 var(--phase5-primary), var(--shadow);
}

#reportes.phase5-audit-mode .phase5-report-hero {
  box-shadow: inset 0 3px 0 var(--phase5-secondary), var(--shadow);
}

#reportes .phase5-report-hero h2 {
  margin: 4px 0 8px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.2;
}

#reportes .phase5-hero-description {
  max-width: 760px;
  margin: 0;
  color: var(--phase5-muted);
  font-size: 14px;
  line-height: 1.45;
}

#reportes .phase5-report-count {
  min-height: 40px;
  border-color: var(--phase5-border);
  background: var(--phase5-canvas);
  color: var(--phase5-ink);
}

#reportes .phase5-report-catalog {
  border: 1px solid var(--phase5-border);
  border-radius: 12px;
  background: var(--phase5-surface);
  box-shadow: 0 16px 42px rgba(30, 30, 30, 0.08);
}

#reportes .phase5-report-catalog > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}

#reportes .phase5-report-catalog > summary::-webkit-details-marker {
  display: none;
}

#reportes .phase5-report-catalog > summary span:first-child {
  display: grid;
  gap: 3px;
}

#reportes .phase5-report-catalog > summary small {
  color: var(--phase5-muted);
  font-size: 13px;
  font-weight: 400;
}

#reportes .phase5-catalog-count {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--phase5-border);
  border-radius: 999px;
  background: var(--phase5-canvas);
  font-size: 12px;
  font-weight: 700;
}

#reportes .report-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0 18px 18px;
}

#reportes .report-card {
  position: relative;
  display: grid;
  align-content: start;
  min-height: 148px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--phase5-border);
  border-radius: 8px;
  background: var(--phase5-surface);
  box-shadow: none;
  color: var(--phase5-ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

#reportes .report-card:hover {
  transform: translateY(-2px);
  border-color: var(--phase5-secondary);
  box-shadow: var(--shadow);
}

#reportes .report-card:focus-visible,
#reportes .phase5-period-button:focus-visible,
#reportes .phase5-density-button:focus-visible,
#reportes .phase5-report-catalog > summary:focus-visible {
  outline: 3px solid var(--phase5-secondary);
  outline-offset: 3px;
}

#reportes .report-card.active {
  border-color: var(--phase5-secondary);
  background: color-mix(in srgb, var(--phase5-primary) 12%, var(--phase5-surface));
  box-shadow: inset 0 0 0 1px var(--phase5-secondary);
}

#reportes .report-card strong {
  margin: 8px 0;
  font-size: 16px;
  line-height: 1.3;
}

#reportes .report-card span:not(.phase5-report-category) {
  color: var(--phase5-muted);
  font-size: 13px;
  line-height: 1.45;
}

#reportes .phase5-report-category {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--phase5-canvas);
  color: var(--phase5-ink);
  font-size: 12px;
  font-weight: 700;
}

#reportes .phase5-periods {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--phase5-border);
  border-radius: 12px;
  background: var(--phase5-surface);
}

#reportes .phase5-period-copy {
  display: grid;
  gap: 3px;
}

#reportes .phase5-period-copy span {
  color: var(--phase5-muted);
  font-size: 13px;
}

#reportes .phase5-period-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

#reportes .phase5-period-button,
#reportes .phase5-density-button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--phase5-border);
  border-radius: 8px;
  background: var(--phase5-surface);
  color: var(--phase5-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

#reportes .phase5-period-button.active {
  border-color: var(--phase5-secondary);
  background: var(--phase5-primary);
  color: var(--brand-on-primary-safe, #1E1E1E);
}

#reportes .report-filters {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 18px;
  border-radius: 12px;
  box-shadow: none;
}

#reportes .phase5-filter-title {
  display: grid;
  grid-column: 1 / -1;
  gap: 3px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--phase5-border);
}

#reportes .phase5-filter-title span {
  color: var(--phase5-muted);
  font-size: 13px;
}

#reportes .report-filters label {
  display: grid;
  gap: 6px;
  color: var(--phase5-ink);
  font-size: 12px;
  font-weight: 700;
}

#reportes .report-filters input {
  min-height: 40px;
}

#reportes .report-actions {
  grid-column: 1 / -1;
  padding-top: 4px;
}

#reportes .phase5-filter-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 38px;
  color: var(--phase5-muted);
  font-size: 12px;
}

#reportes .phase5-filter-summary-label {
  font-weight: 700;
}

#reportes .phase5-filter-chip {
  display: inline-flex;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--phase5-border);
  border-radius: 999px;
  background: var(--phase5-surface);
  color: var(--phase5-ink);
}

#reportes .phase5-report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

#reportes .phase5-summary-card {
  display: grid;
  gap: 5px;
  min-height: 116px;
  padding: 18px;
  border: 1px solid var(--phase5-border);
  border-radius: 12px;
  background: var(--phase5-surface);
}

#reportes .phase5-summary-card span {
  color: var(--phase5-muted);
  font-size: 12px;
  font-weight: 700;
}

#reportes .phase5-summary-card strong {
  color: var(--phase5-ink);
  font-size: 24px;
  line-height: 1.2;
}

#reportes .phase5-summary-card small {
  color: var(--phase5-muted);
  font-size: 12px;
  line-height: 1.35;
}

#reportes .phase5-summary-card.attention {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--phase5-warning) 45%, transparent);
}

#reportes.phase5-audit-mode .phase5-summary-card:first-child {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--phase5-secondary) 35%, transparent);
}

#reportes .phase5-table-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-top: 6px;
}

#reportes .phase5-table-header h3 {
  margin: 2px 0 4px;
  font-size: 16px;
}

#reportes .phase5-table-header p {
  margin: 0;
  color: var(--phase5-muted);
  font-size: 13px;
}

#reportes .phase5-table-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 700;
}

#reportes .phase5-table-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

#reportes .phase5-scroll-hint {
  max-width: 250px;
  color: var(--phase5-muted);
  font-size: 12px;
  text-align: right;
}

#reportes .phase5-report-table-wrap {
  position: relative;
  max-height: 64vh;
  margin: 0;
  border-radius: 12px;
  background: var(--phase5-surface);
}

#reportes .phase5-report-table-wrap.is-loading::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  min-height: 160px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--phase5-surface) 88%, transparent);
  color: var(--phase5-ink);
  font-weight: 700;
  content: 'Actualizando reporte…';
  z-index: 6;
}

#reportes .phase5-report-table-wrap table {
  min-width: 1120px;
}

#reportes .phase5-report-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--phase5-secondary);
  color: var(--brand-on-secondary-safe, #FFFFFF);
  white-space: nowrap;
}

#reportes .phase5-report-table-wrap th:first-child,
#reportes .phase5-report-table-wrap td:first-child {
  position: sticky;
  left: 0;
  min-width: 160px;
}

#reportes .phase5-report-table-wrap th:first-child {
  z-index: 4;
}

#reportes .phase5-report-table-wrap td:first-child {
  z-index: 2;
  background: var(--phase5-surface);
  font-weight: 700;
  border-right: 1px solid var(--phase5-border);
}

#reportes .phase5-report-table-wrap tbody tr.phase5-attention-row td {
  background-color: color-mix(in srgb, var(--phase5-warning) 8%, var(--phase5-surface));
}

#reportes .phase5-report-table-wrap tbody tr.phase5-attention-row td:first-child {
  border-right: 1px solid var(--phase5-border);
}

#reportes.phase5-density-compact .phase5-report-table-wrap th,
#reportes.phase5-density-compact .phase5-report-table-wrap td {
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 12px;
}

@media (max-width: 1100px) {
  #reportes .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #reportes .phase5-periods,
  #reportes .phase5-table-header {
    align-items: flex-start;
    flex-direction: column;
  }

  #reportes .phase5-period-actions,
  #reportes .phase5-table-tools {
    justify-content: flex-start;
  }

  #reportes .report-filters,
  #reportes .phase5-report-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #reportes .phase5-scroll-hint {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 680px) {
  #reportes.phase5-reports-audit {
    gap: 14px;
  }

  #reportes .phase5-report-hero {
    padding: 18px;
  }

  #reportes .phase5-report-hero h2 {
    font-size: 24px;
  }

  #reportes .phase5-report-catalog > summary,
  #reportes .phase5-periods,
  #reportes .report-filters {
    padding: 14px;
  }

  #reportes .report-grid,
  #reportes .report-filters,
  #reportes .phase5-report-summary {
    grid-template-columns: 1fr;
  }

  #reportes .report-grid {
    padding: 0 14px 14px;
  }

  #reportes .report-card {
    min-height: 126px;
  }

  #reportes .phase5-period-actions,
  #reportes .phase5-period-button,
  #reportes .phase5-density-button,
  #reportes .phase5-table-tools,
  #reportes .report-actions,
  #reportes .report-actions .btn {
    width: 100%;
  }

  #reportes .phase5-period-button,
  #reportes .phase5-density-button {
    min-height: 44px;
  }

  #reportes .phase5-table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  #reportes .phase5-report-table-wrap th:first-child,
  #reportes .phase5-report-table-wrap td:first-child {
    position: static;
    min-width: 170px;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #reportes .report-card {
    transition: none;
  }
}
